Thanks Jochem. You're great!

-----Mensagem original-----
De: Jochem Maas [mailto:[EMAIL PROTECTED] 
 
pmpa wrote:
> Hi all!
> 
> This is probably a stupid question, but I have to ask :)
> Which takes less processing?

not stupid.
say there is a few microseconds of difference in the parsing/compiling

(in the case of comments the zend engine is more or less stripping
them out as far as 'building a runable script' is concerned -
i.e. comments are executed)

...and your script take 1 second to run, you wil never notice a couple
of microseconds, besides server load would have a much greater effect
on processing time.

whether the comment is 2K or 2bytes will hardly
make a difference I think.

as always: there is a good rule to follow regarding comments:

1. use LOTS
2. try to use 'structured' comments (e.g. comments that are parsable by, for
instance, phpDoc)

as a 'noob' I wouldn't worry about speed at all, if you
want to worry about something worry about security - a
slow safe script is better than a fast hackable one....
besides I remember just struggling to get things done at all
when I first started let alone make my code go fast!

If you are really worried about speed then you should realise that
the running of the script will generally speaking take many factors more
time than the parsing of the script (prior to running). so called
'heavy things' include:

1. creating objects (so much so that if you are creating lots of similar
objects
that I find its better to use a factory method that holds a precreated
object and
clones that on request rather than actually creating a new object each time)

2. calling functions.

but don't worry about it to start with... just get on and write some code!
have fun.

---

if at some stage your collection of scripts become so large. or the load
on your server becomes to great then its probably time to look at a
php accelerator (the idea of which is to precompile your scripts so that you
don't have the compile overhead each time a script is called.). there are a
few
different options out there when it comes to accelerators, have a google.

---
...lastly you might want to test how long it take to run. if so search the
mailing
list archive for a thread entitled : 'PHP Slowness' - it will hopefully give
you some tips regarding rudimentary timing of you scripts.

> 
> 1)
> /***********************************/
> 
> 2)
> ///////////////////////////////////
> 
> 3)
> //*********************************
> 
> 4)
> /*
>   I'm a noOb
>   :)
> */
> 
> 5)
> //
> // text
> //
> 
> 
> Thanks!
> 
> Pedro.
> 

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to