Commit Graph

8 Commits

Author SHA1 Message Date
David Mudrak 4efff581eb get_string() performance tester: small formal fixes 2009-11-24 15:09:48 +00:00
Penny Leach edf1fc350a portfolio: MDL-20892 moved portfolio/type/* plugins to portfolio/* 2009-11-18 13:27:38 +00:00
Moodle HQ git importer 8926f8449f Fixing drift between CVS and git 2009-11-02 00:32:03 +00:00
samhemelryk de6d81e667 admin MDL-19799 Upgraded print_header and build_navigation calls to use PAGE and OUTPUT equivilants 2009-09-03 06:59:25 +00:00
nicolasconnault aa9a686740 MDL-19799 Upgraded calls to helpbutton, print_simple_box* and notify 2009-08-18 05:20:12 +00:00
nicolasconnault 7e0d66753e MDL-19799 Converted all print_footer() calls 2009-08-06 14:21:34 +00:00
nicolasconnault 3c15938527 MDL-19799 Migrated calls to print_heading 2009-08-06 08:19:21 +00:00
tjhunt bb45fe62c4 get_string: Refactoring, performance improvements, bug fixes and unit tests
MDL-18669 get_string refactored to elimiate duplicate code and make it easier to understand.
MDL-17763 parent language not processed correctly when getting a plugin string.
MDL-16181 more intelligent caching to avoid repeated file_exists checks.
MDL-12434 move values to array keys to improve lookup times.

The main part of the refactoring is to create a singleton string_manager class to encapsulate the cached data and the processing, while breaking the code up into more smaller methods.

Other performance improvements include:
* Cache results of plugin name -> locations to search array.
* Cache parent lang lookup.
* Skip eval if the string does not contain $ \ or %.
* Remove the unnecessary sprintf from the eval.

There is a performance testing script in lib/simpletest/getstringperformancetester.php. For now this script has the old get_string implementation copied and pasted to the end, and renamed to old_get_string to allow for comparitive timings.

There are now some unit tests for get_string in lib/simpletest/teststringmanager.php. I think I have managed to cover most of the tricky cases.
2009-03-30 02:21:27 +00:00