Re: [PHP] Question concerning performance
On Wednesday 17 January 2001 11:37, jeremy wrote: Example ONE: (in just parse mode) [cut]--- ? print "html-tagblah blah blah blah blah blah blah/html-tag"; print "html-tag" . $Var1 . "/html-tagb-tag" . $Var2 . "/b-tag"; ? [/cut]-- Example TWO: (in html parse mode) [cut]--- html-tagblah blah blah blah blah blah blah/html-tag html-tag?=$Var1;?/html-tagb-tag?=$Var2;?/b-tag [/cut]-- Now, let me elaborate. I'm quite aware that the above 2 code segments will both be fast enough for me not to care. BUT, within an application that has 1000 lines of code per page (hypothetically), everything begins to matter, and the more cpu-clicks I can save, the happier I'll be. With big applications the *main* thing that matters is maintainability. In other words: Make it work, make it work well, make it maintainable and *then* make it as fast as possible while *keeping* it maintainable (and working of course) The 2 examples will turn out the same results to the browser, but which will do it faster? Don't care about it. The difference is most lileky in th 0.1% range. Look at bigger optimizations first, then benchmark and if it still is too slow (and only then) optimize further. -- Christian Reiniger LGDC Webmaster (http://sunsite.dk/lgdc/) The most exciting phrase to hear in science, the one that heralds new discoveries, is not "Eureka", but "That's funny..." - Isaac Asimov -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] Question concerning performance
Example ONE: (in just parse mode) [cut]--- ? print "html-tagblah blah blah blah blah blah blah/html-tag"; print "html-tag" . $Var1 . "/html-tagb-tag" . $Var2 . "/b-tag"; ? [/cut]-- Ran a pretty rough benchmark: 10040 lines of code (5020 repetitions of the above example) 10 times with an average execution time of 6.07904628515244 seconds. Example TWO: (in html parse mode) [cut]--- html-tagblah blah blah blah blah blah blah/html-tag html-tag?=$Var1;?/html-tagb-tag?=$Var2;?/b-tag [/cut]-- Same benchmark, except these two lines were used instead of the two lines in the above case (obviously). Again, 10 executions; this time the average execution time was 6.40339350700379 seconds. There are 100 ways error could've been introduced into this test; even so, the results seem to lean towards not switching between html php modes... although, you're talking about 1000 lines of code, and the test used 10 times that, and the resulting difference was a little more than 3 tenths of a second... if you compared it with 1/10th of the code (your 1000 line file), you'd probably have a difference in the hundredths-of-a-second range. It's up to you, but I agree with what Christian said - I'd probably shoot for being able to maintain the code; with such a little speed difference you might as well set up more servers than optimize for 1/5th of a second in execution time. --Toby -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] Question concerning performance
PHP's time functions and this little library I put together a while back - http://imawebdesigner.com/utils/runtime_clock --Toby - Original Message - From: "jeremy" [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Wednesday, January 17, 2001 12:49 PM Subject: RE: [PHP] Question concerning performance Now THAT's the kind of answer I was looking for. Thanks very much for checking that out. Mind if I ask what you used for your benchmarking/timing software-wise? blest, jeremy -- Jeremy Kelley [EMAIL PROTECTED] pgp keyid 0xAECBA355 Phil 1:21 www.ganooz.com Car pour moi, la vie c'est le Christ, et la mort est un gain. -Original Message- From: Toby Butzon [mailto:[EMAIL PROTECTED]] Sent: Wednesday, January 17, 2001 16:55 To: jeremy; [EMAIL PROTECTED] Subject: Re: [PHP] Question concerning performance Example ONE: (in just parse mode) [cut]--- ? print "html-tagblah blah blah blah blah blah blah/html-tag"; print "html-tag" . $Var1 . "/html-tagb-tag" . $Var2 . "/b-tag"; ? [/cut]-- Ran a pretty rough benchmark: 10040 lines of code (5020 repetitions of the above example) 10 times with an average execution time of 6.07904628515244 seconds. Example TWO: (in html parse mode) [cut]--- html-tagblah blah blah blah blah blah blah/html-tag html-tag?=$Var1;?/html-tagb-tag?=$Var2;?/b-tag [/cut]-- Same benchmark, except these two lines were used instead of the two lines in the above case (obviously). Again, 10 executions; this time the average execution time was 6.40339350700379 seconds. There are 100 ways error could've been introduced into this test; even so, the results seem to lean towards not switching between html php modes... although, you're talking about 1000 lines of code, and the test used 10 times that, and the resulting difference was a little more than 3 tenths of a second... if you compared it with 1/10th of the code (your 1000 line file), you'd probably have a difference in the hundredths-of-a-second range. It's up to you, but I agree with what Christian said - I'd probably shoot for being able to maintain the code; with such a little speed difference you might as well set up more servers than optimize for 1/5th of a second in execution time. --Toby -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]