Here's a couple of ideas for increasing Drupal runtime speeds I picked up while digging trough the code.
replace array_key_exists($name,$array) with isset($array[$key]);
Isset is about 2.5 times faster. One thing to notice is that behavior isn't identical:
$array['key'] = NULL; var_dump(isset($array['key'])); // false var_dump(array_key_exists('key', $array)); // true
This will have no change in drupal; drupal_static has about 300 calls on a "minimal setup" (on an authenticated front page refresh), and checks a key before setting it. I couldn't find any key set to null while checking with xdebugs.collect_params
Serialize/unserialize has gotten a couple of contenders. These are considerably faster. Since serialize/unserialize have hundreds of calls per pageview on a normal Drupal site, this will make a noticeable impact. Here's a [benchmark_framework] that compares a couple of serializers currently available.
drupal_parse_info_format fetches defined constants on each instantiation which is painfully slow (and memory hungry). This should be stored on first get and only be accessed from the local scope.
I haven't read enough code do decide if this define chain is manipulated between reads, so that would also have to be verified before storing.
NOTE: WIP - see http://drupal.org/node/805416 The image.module (and perhaps in other places) processes images ineffectively since they first process it, store the image and then reads the buffer and returns an image.
[benchmark_framework] | http://github.com/jbergstroem/instabench/ |