I ran a few tests, and found that current_language() gets called around
150 times on the biggest pages.

The way the function is currently written, it takes about 5 microseconds
to run, on average. If I put a naive short-circuit in there ("if
(isset($lastlang)) return $lastlang;"), then it takes a little less than
1 microsecond to run.

So at best we're looking at a savings of about 0.6 milliseconds per page
load. I know every little bit counts, but I think this one might be too
small to be worth the risk of bugs.

-- 
You received this bug notification because you are a member of Mahara
Contributors, which is subscribed to Mahara.
Matching subscriptions: Subscription for all Mahara Contributors -- please ask 
on #mahara-dev or mahara.org forum before editing or unsubscribing it!
https://bugs.launchpad.net/bugs/1523310

Title:
  Avoid calling current_language() for each of the help icons  on a page

Status in Mahara:
  New

Bug description:
  As the language can't change part way throuh page load we can set the
  $lang variable in get_helpfile_location() to be static

To manage notifications about this bug go to:
https://bugs.launchpad.net/mahara/+bug/1523310/+subscriptions

_______________________________________________
Mailing list: https://launchpad.net/~mahara-contributors
Post to     : [email protected]
Unsubscribe : https://launchpad.net/~mahara-contributors
More help   : https://help.launchpad.net/ListHelp

Reply via email to