tokuhirom's blog

Shipped HTML::Escape, extremely fast HTML escaping

HTML::Escape is a drop out module from Text::Xslate.
Text::Xslate have a pretty fast HTML escaping feature, but it's a big library.
Perl mongers doesn't want to depend Text::Xslate.

use HTML::Escape qw/escape_html/;
 
escape_html("<^o^>");

It's pretty faster than HTML::Entities, thanks.

                 Rate HTML::Entities   HTML::Escape
HTML::Entities 14.0/s             --           -91%
HTML::Escape    150/s           975%             --

Code was mostly copied from gfx's. thanks!

Created: 2012-09-30T08:06:18Z
Updated: 2012-09-30T08:06:18Z
comments powered by Disqus