OK, yet another patch.
Changes in the get_string implementation:
1. Factored out locations_to_search($module) and cache the results of that in an array to save work.
2. Avoid eval altogether if strpos($result, '$') === false && strpos($result, '
') === false
3. Strip the sprintf out of the eval, and so get rid of clean_getstring_data
(1. is a small performance win.
2. is a big performance win.
3. amazingly makes not difference, but it is better without it.)
Changes to the performance script:
A. Instead of repeating the same get_string call, we instead play back the sequence of get_string calls used by various real Moodle pages. I am using admin/index.php (2000 get_strings) and course/view.php with editing on (350 get_strings).
B. To let me do that, I added some code to get_string to record the sequence of calls. I left the code in there, but commented out.
C. I added the old get_string to the end of that file, so I can do comparative timings.
Not, I find the times fluctuate a lot if you reload the test scrip, I am not sure why, but it is always worth doing several runs and averaging.
Things still to do:
- Write unit tests to ensure correctness.
- Fix help.php.
Adding David too...