Performance

MySQL performance tips from around the web

Gospel: use InnoDB, never MyISAM It seems everybody on StackExchange is singing from the same gospel: “[How can I] prevent queries from waiting for table level lock?” Answer: use InnoDB. The major advantages of InnoDB over MyISAM. “Even in a read-intesive system, just one DELETE or UPDATE statement will quickly nullify whatever benefits MyISAM has.” […] » about 400 words

Testing apply_filters() times

Testing how long it takes to assign a variable versus assigning through WordPress’ apply_filters(). Filters are core to WordPress, but I haven’t yet looked at the total number of apply_filters() calls used throughout the code. The answer to this question is that calling a non-existing filter before assignment is about 21 times more costly than […] » about 300 words

Testing file include times for a file that may or may not exist

Question: Should you check for a file before attempting to include it, or just suppress errors? Calling file_exists requires stating it twice if the file does exist, so that could take longer. Answer: the file_exists pattern is more than five times faster than the @include pattern for a file that doesn’t exist, and not substantially […] » about 300 words

Site Load Performance Benchmarks

The Loop’s Jim Dalrymple compiled the following numbers for the time it takes various tech sites to load in a browser in late 2011:

  • The Loop: 38 requests; 38.66KB; 1.89 secs
  • Daring Fireball: 23 requests; 49.82KB; 566 milliseconds
  • Macworld: 130 requests; 338.32KB; 8.54 secs
  • Ars Technica: 120 requests; 185.99KB; 2.08 secs
  • Apple: 46 requests; 419KB; 1.39 secs
  • CNN: 196 requests; 269.41KB; 4 secs
  • BGR: 368 requests; 2.74MB; 35.33 secs
  • AppleInsider: 141 requests; 649.39KB; 5.64 secs
  • Facebook: 137 requests; 993.54KB; 11.19 secs
  • MacStories: 119 requests; 2.16MB; 2.13 secs

John Gruber started this by calling out The Next Web for it’s slow performance:

  • TheNextWeb: 342 requests; 6MB; no time info

More benchmarks can be seen at Browsermob.

WordPress comments_template() and wp_list_comments() Performance

This thread on memory usage while executing WordPress’s comments_template() raised my awareness of performance issues related to displaying comments on posts in WordPress. The first thing to know is that all the comments on a given post are loaded into memory, even if the comments are paged and only a subset will be displayed. Then comments_template() calls update_comment_cache(), […] » about 500 words

Speed WordPress MultiSite With X-Sendfile For Apache

Like WordPress MU before, MultiSite implementations of WordPress 3.0 use a script to handle image and other attachment downloads. That script checks permissions and maps the request path to the files path on disk, then reads the file out to the web server, which sends it to the browser. That approach has some inefficiencies, and […] » about 400 words

Why PHP’s RegEx Is Slow, And What You Can Do About It (if you happen to be a committer on the PHP project)

Regular Expression Matching Can Be Simple And Fast, by Russ Cox:

Perl [and PHP and others] could not now remove backreference support, of course, but they could employ much faster algorithms when presented with regular expressions that don’t have backreferences.

How much faster? About a million times (no, I do not exaggerate).

I use a lot of regular expressions, and relatively few of them use backreferences. It’d be worth optimizing.