I thought this was kinda cool ( I chose this book because it has my dad in it)
So I spent 20 mins whacking some caching in around the _build_langauges_arrayref subroutine in C4::Languages in Koha.
Before and After. Ill take that as a win. All that needs to be done now is add code to the script that handles updating the language syspref, so that it clears the cache when its changed.
So far ive only profiled opac-search.pl and opac-main.pl, the results are here. From them I can see doing some caching in the C4::Languages module might speed things up. If you look here you can see its doing a lot of work, and it does this work for each page. So if we cache the data structure resulting from the build_langauges_arrayref, and just return that in the subsequent calls, we should win some decent performance.
Ill work on that tomorrow night, and post the new profiles