t() calles module_exist("locale") every time it is invoked, replacing this call by function_exists doubles the speed of t().
| Comment | File | Size | Author |
|---|---|---|---|
| 20040109.locale-module-exist.patch | 628 bytes | bart jansens |
t() calles module_exist("locale") every time it is invoked, replacing this call by function_exists doubles the speed of t().
| Comment | File | Size | Author |
|---|---|---|---|
| 20040109.locale-module-exist.patch | 628 bytes | bart jansens |
Comments
Comment #1
gábor hojtsyIf we really want to get rid of t() speed problems, then we can cache the return value of the check done on every t() call, since $languages and module_exists('locale') is not supposed to change in a Drupal run AFAIK. Something like:
That would only cost an isset() check second and all subsequent times t() is called. This is probably just nitpicking though... I am not sure this would lead to any significant gains... Maybe.
Comment #2
gábor hojtsyThe recursive call to t() is just a typo, I mean locale() :)
Comment #3
killes@www.drop.org commentedI propose to change the implementation of module_exist instead.
Currently it uses isset($list[$name]) which seems fo be slower than function_exists(). We should do a function_exists on a function that every module has. (_help?).
Comment #4
moshe weitzman commenteddoes anyone have any benchmarks to justify the claim of 2x speed increase with this patch?
Comment #5
(not verified) commentedActually i should stay away from my computer when i have a headache, makes me remember things all wrong. The 2x was just in a special case, otherwise the difference isnt that big (5ms vs 6ms iirc).
Comment #6
moshe weitzman commented