On Wed, May 29, 2013 at 10:21 AM, Tyler Romeo <[email protected]> wrote:
> 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?

Sounds like you're comparing apples to oranges here. What
happens to the speed when you change Html::element() and
friends? To (average) page size?

-Chad

_______________________________________________
Wikitech-l mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/wikitech-l

Reply via email to