Ask HN: New website review - micro-optimization.com

1 points by zabuch ↗ HN
I've had this idea for a long time and finally got some spare time to put the site together: http://micro-optimization.com . I'm not a big fan of early optimizations or micro-optimizations and I'm not interested in the old, ongoing discussion about them being recommended vs considered harmful. I'm not trying to encourage or discourage them.

I though it would be interesting though, to actually (properly) test and document how much really is that ++i faster than i++.

I can hear occasionally developers saying that "I've heard that function X is faster than Y, so we should use it". Here you go so: there is no need for guessing, it can simply be tested and documented.

I've started with some common PHP micro-optimization myths out there. I've tried to get as accurate tests as possible. I'm also running tests on different versions of PHP and on different machines.

Please let me know what do you think about the site. Be warned - I'm not a very good graphic designer!

3 comments

[ 3.0 ms ] story [ 15.0 ms ] thread
I like the idea of the site, very interesting.

As a suggestion, how about a haskell.micro-optimization.com, rb.micro-optimization.com, or py.micro-optimization.com? I feel like this could be a nice resource if it included more languages.

How does the performance of PHP CLI compare to the apache so model? Also trying to time using the 'time' command is tricky because you have multiprocess effects that add overhead.
I hope that using CLI will actually give better results (on top of being easier to test!) as this allows for testing just PHP - ignoring the whole stack. To mitigate testing using just "wall clock", I repeat tests hundreds of times and then drop 50% slowest results. At the end I calculate the average and standard deviation. I review standard deviation values to spot any weird results. I also try to make sure that the machines that are running the tests are as good as they can: they don't run any GUI, all services including cron are disabled, I run the same test at different hours, etc.