Messi wrote:
2005/6/24, Brion Vibber <brion(a)pobox.com>om>:
Mass-changing double quotes to single quotes has
no actual benefits.
Won't parsing be faster? Or is it really a myth?
There is a difference in speed but it's quite small and IMHO doesn't
justify effort spent on it.
I just did a quick test under PHP 4.3.10; parsing a huge file of 5000
200-character single-quoted strings 100 times is about 2.5% faster than
parsing the same file with double-quoted strings.
The $wgAllMessagesEn array parses in about 15 milliseconds on my test
box (2 GHz Athlon XP), so a 2.5% speedup/slowdown would be a fraction of
a millisecond, easily lost in the noise.
Further, on a server using Turck MMCache, eAccelerator etc the tiny
speedup will likely only happen once, as the script is not reparsed on
each load.
* Bugs are
often introduced (some quotes missed, escaped metacharacters
missed, embedded variables missed)
This can be done quickly by a script that writes a new LanguageXx.php.
(e.g.
http://meta.wikimedia.org/wiki/User:Messi/d2s_script
This script doesn't seem to take other escaped chracters into account
(for instance \n or \t).
Btw, is it safe to single quote strings with $1?)
$1, $2 etc are not special in double-quoted strings; they get replaced
by the wfMsg* functions at runtime. So they're safe in single-quoted
strings too.
-- brion vibber (brion @
pobox.com)