I am sorry it is taking some time for me to dig into this. Lots of other work in the middle.
Yesterday we had brief tour of v2.5 with Justin Filip. Notes and observations from a couple runs on his nice idle MBP...
* Logged in as admin an _empty_ moodle site took ~2s to load homepage. dbqueries were around 30, which is low, but 2s is an eternity, which makes me suspicious that the caches are expensive.
* Disabled caches completely -- whoopeee! >600 dbqueries! -- we used xhprof and got an excellent callgraph. There are clearly things to work on there -- >300 calls to get_module_list(). I know I've been out of the moodle world for a while but... how about disabling this caching facility during development (or on master), so the dbquery inflation is kept in check?
* Got a callgraph with caches on, which quickly pointed at a problem in the files cache, which is pointlessly MD5()ing the same stuff twice for no gain. Look for md5 in cache/stores/file/lib.php -- there is no way that'll catch something. If the kernel/FS code is so broken as to fail that test, Moodle will never execute this far. Except perhaps ENOSPC but we can check for errors in the write() and fflush(). As it stands, md5_file() was ~ 17% of exec time.
* The callgraph() also shows that we were rewriting most/all the caches, even if nothing had changed.
* Caching mdl_config has a silly chicken-and-egg problem because the caching configuration is stored in... oh, nevermind. (Hint: simplify/automate the caching configuration, and move the tunables to defines in config.php).
* Looking at the "files" caching scheme... it tries to do hashing for the directories... but it is defeated by having a prefix on the filename!
* It seems, at very first blush, to be caching global things on a per-session basis. This is probably a mistake in my observations - why would we cache mdl_config keyed on user session?
* Relatedly, using sessionkey to derive a filename does not seem like a good idea at first blush.
These are early notes I wanted to share. I do intend to dig more deeply into this, but it may take me some time.
At this point the MUC code flow & call graph leaves me scratching my head plenty; it will take some more time to wrap my head around it.
Tim Hunt has been doing some research on this same track, and I like his listing of bugs (yesterday I had the right tracking bug, today I lost it

-- /me shakes fist at Jira).