Re: Is there a big speed difference...

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Brian Dunning wrote:
I have an include file with about 6 lines of code, just text parsing. If I have to loop through 5000 records, is there a big difference between (a) calling this include file 5000 times, and (b) defining a function and just calling the function 5000 times?

or (c) just placing the code inside the loop - no function call , no include,
just wash and go ;-) - whichever is faster of (a) and (b), my (c) will be faster still. :-)

if you really really care about a few microseconds then test it. theory is
only half the story, the machine you run it on, the average load it has, etc, etc
will be the biggest factor in real world performance.

btw 5000 records is a small number, I have a script that regularly does syncing
on a 500,000 strong customer recordset - it runs for 3-4 minutes, but it runs. :-/
just to given an indication that your 5000 records will be processed in
a matter of seconds ... of course if you expect the recordset to grow substantially
during the lifetime of your code you should factor this in (which means testing
with a much bigger dataset probably)





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


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux