So I ran a brief benchmark on my vagrant instance recently (nothing fancy,
just 50,000 iterations of a single line of code), and I found that
htmlspecialchars() performs *significantly* faster than strtr() (a
difference of like 37%).

Html::element (and other places in the Html class) prefer using strtr()
with a manual list of some elements rather than htmlspecialchars(). The
reasoning behind this (I think) is do make the output document slightly
smaller by a few bytes by not escaping unnecessary items.

So my question is if the byte reduction is really worth it, or if we would
rather have a 37% reduction in escaping speed?
*-- *
*Tyler Romeo*
Stevens Institute of Technology, Class of 2016
Major in Computer Science
www.whizkidztech.com | [email protected]
_______________________________________________
Wikitech-l mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/wikitech-l

Reply via email to