Now that chx has beaten me to it, I'm going to profile and patch and find all the low hanging fruit to cache in drupal. Here's an improvement to the module_hook function.
What's interesting about these last couple of patches is that for an install, the result is probably the same - so while we are 'caching' the output to a static variable, it may be perfectly reasonable to cache all of these arrays somewhere in memory (memcached, anyone?) and then have them for all threads - saving each thread the cost of construction of the array.
chx better not have beat me to this one!
Performance data: (http_load on a CCK node page, 500 fetches, two samples before and after the change)
Before the patch:
17.565 fetches/sec, 204896 bytes/sec
msecs/connect: 0.149726 mean, 0.6 max, 0.118 min, 0.035722 stddev
msecs/first-response: 54.8222 mean, 64.249 max, 53.426 min, 0.814898 stddev
17.606 fetches/sec, 205374 bytes/sec
msecs/connect: 0.144368 mean, 0.251 max, 0.119 min, 0.0252939 stddev
msecs/first-response: 54.7124 mean, 60.375 max, 53.48 min, 0.636029 stddev
And with it:
17.9116 fetches/sec, 208939 bytes/sec
msecs/connect: 0.141478 mean, 0.349 max, 0.105 min, 0.0254099 stddev
msecs/first-response: 53.6751 mean, 58.663 max, 52.455 min, 0.681214 stddev
17.9231 fetches/sec, 209073 bytes/sec
msecs/connect: 0.142412 mean, 0.239 max, 0.12 min, 0.0237095 stddev
msecs/first-response: 53.6477 mean, 58.638 max, 52.5 min, 0.508483 stddev
I like it. Time to submit this upstream...