Decaflon

Welcome to Decaflon! Where the geeks hang out: Signup or Login Here
Decaflon is proudly hosted by (mt) Media Temple.  We recommend them for your web hosting needs.
Clips: Popular Clips Upcoming Clips Notes: All Notes

From the Clip The PHP Benchmark posted by JoeLencioni:

a way to open people's eyes to the fact that not every PHP code snippet will run at the same speed

 

This was a great article and I didn't even realize that such a subtle change in code would have such adverse effects to the speed of it. Especially crazy because the majority of our code runs off of foreach loops so over time I will be going back and recycling through them to change them to while loops.

Has anyone else seen speed improvements with changes in their PHP code?

Looking at that chart, foreach is the fastest. The lower the time it takes the better, no?

My main improvements are reducing/optimizing database calls.

Whoa, what the hell? Yesterday he had the while loop as much, much faster. Someone must've found an error in his testing code.

Ah yup:

Given that the previous version of the tests have been very controvercial and incorrect, I must appologise for forgetting to implement the reset() function to allow the while() loops to start from the beginning instead of the end. Thanks to Anthony Bush for spotting this out.

Please Login To Leave A Comment

Decaflon Sponsors Get in touch if you want in.

Hot Notes (View all »)

 

Decaflon is part of the Chawlk Network of sites.

9 Great Places To Visit, Hang Out, & Meet New People

What's new and interesting at other Chawlk Network sites: