Professional PHP

PHP Programming, Web Development, PHP Advocacy and PHP Best Practices.
« PHP Application Security
rsync to remote server via ssh »

Flawed Microbenchmarks

February 24th, 2005

Anatomy of a flawed microbenchmark highlights some of the problems involved in creating microbenchmarks (Java oriented).

The scary thing about microbenchmarks is that they always produce a number, even if that number is meaningless. They measure something, we’re just not sure what. Very often, they only measure the performance of the specific microbenchmark, and nothing more. But it is very easy to convince yourself that your benchmark measures the performance of a specific construct, and erroneously conclude something about the performance of that construct.

Even when you write an excellent benchmark, your results may be only valid on the system you ran it on. If you run your tests on a single-processor laptop system with a small amount of memory, you may not be able to conclude anything about the performance on a server system.

This is why I prefer to benchmark with ab rather than microtime().

Filed Under

  • PHP

Related Posts

  • Microbenchmarks of single and double qouting.
  • The Legality of Republishing RSS Feeds
  • The Usability of Input Filtering
You can leave a response, or trackback from your own site.

3 Responses to “Flawed Microbenchmarks”

  1. Lukas says:
    2/24/2005 at 3:00 pm

    Another good example is people measuring the performance overhead of parsing PEAR.php and then mentally multiplying this by the number of PEAR packages that use PEAR.php in their code. Obviously adding infrastructure code in userland is going to incurr overhead, however the point if such code is to make your general life easier. Therefore you are likely to make heavy use of said infrastructure code. This means that the parsing overhead will diminish. Obviously though you would want PEAR.php to have efficient code since its likely that code contained therein is going to be called often.

  2. admin says:
    2/25/2005 at 9:33 am

    Indeed. Good point.

    One might make the same point about breaking large code bases up into multiple small files. Bad for microbenchmarking, good for flexibility, reuse and modularity. :)

  3. Jeff Moore’s Blog » Blog Archive » Microbenchmarks of single and double qouting. says:
    3/8/2005 at 4:23 pm

    [...] Microbenchmarks of single and double qouting. I wrote earlier about flawed microbenchmarks. Today on sitepoint, there was a post on the perf [...]

Leave a Reply

Click here to cancel reply.

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

code: use [code=php][/code].

Comment Preview

    Subscribe Feed
    Share Subscribe to this blog…
    Share Bookmark or share this page…
  • About

    My name is Jeff Moore. I'm a PHP programmer living in San Francico and working for a startup.

    More about me…

  • Categories (Home)

    • Agile Methods (14)
    • Mac (14)
    • Misc (17)
    • Open Source (14)
    • PHP (98)
    • Software Design (29)
    • Usability (14)
    • Web Design (20)
  • Recent Comments

    • Programming Language Trends via Google  19
      Craigslist pva, jessica, Scott [...]
    • Looking Towards the Cloud  35
      bentonville multiple listing, cosmetic dental, Sam Brodish [...]
    • PHP versus ASP  8
      Marhta Blight, Ravi, Ryan Brooks [...]
    • How to Transfer Mac OS X Application Data between Computers  59
      Website Migration, harry the computer support guy, Dotty Salvage [...]
    • Working with PHP 5 in Mac OS X 10.5 (Leopard)  157
      lehuuphuc, Robert Parthemer, Lingerie Intimate [...]
    • PHP Games  25
      jessica, Tennille Cranor at Chilli Plants, Lucas Ortell [...]
    • un-PEAR-ing  5
      jessica, Eugene Panin, Arnaud [...]
    • The Legality of Republishing RSS Feeds  23
      kevinxiao, Marissa Miscovich, Quick Student Loans [...]
    • Faster Page Loading  4
      jessica, angular cheilitis, Aaron Rosenfeld [...]
    • PDO versus MDB2  15
      jessica, kevinxiao, Gavin [...]
  • Recent Posts

    • ZendCon: Writing Maintainable PHP Code
    • Looking Towards the Cloud
    • Holiday Tech Support
    • Closures are coming to PHP
    • php | tek Wrapup
    • php | tek 2008
    • Sarah Snow Stever
    • Benchmarking PHP’s Magic Methods
    • The Endpoints of the Scale of Stupidity on Video
    • Working with PHP 5 in Mac OS X 10.5 (Leopard)
  • Site

    • Archives
    • Log in
  • Search