https://bugzilla.wikimedia.org/show_bug.cgi?id=26605

--- Comment #3 from Brion Vibber <br...@pobox.com> 2011-01-08 01:19:48 UTC ---

I did some tweaks to the benchmark in r79854; results on my test box (MacBook
Pro, 2.4GHz Core 2 Duo, Mac OS X 10.6.6, 64-bit PHP 5.3.4 built via MacPorts)
with 10,000 reps:

$ php bench_strtr_str_replace.php --count=10000
10000 times: function bench_strtr_str_replace->benchstrtr() :
19.67ms ( 0.00ms each)
10000 times: function bench_strtr_str_replace->benchstr_replace() :
22.05ms ( 0.00ms each)
10000 times: function bench_strtr_str_replace->benchstrtr_indirect() :
22.53ms ( 0.00ms each)
10000 times: function bench_strtr_str_replace->benchstr_replace_indirect() :
26.29ms ( 0.00ms each)


It takes at least 3000 reps to make a 1ms difference in execution time, so it's
not likely to make a big performance difference to make this change.

But -- as happy coincidence, the difference in execution time is about the same
as the difference from adding a level of function-call indirection. This means
that replacing the str_replace() calls with calls to a nice global function,
and having it use strtr, would have almost no performance impact, but would
allow for changing the underscore/space normalization rules globally MUCH more
easily.

So, if you *are* inclined to go changing all those bits, I'd recommend
encapsulating them in a nice function and concentrating on how it makes
maintenance and customization easier.

-- 
Configure bugmail: https://bugzilla.wikimedia.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.
You are on the CC list for the bug.

_______________________________________________
Wikibugs-l mailing list
Wikibugs-l@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/wikibugs-l

Reply via email to