https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=20975 Julian Maurice <julian.maurice@biblibre.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |julian.maurice@biblibre.com --- Comment #8 from Julian Maurice <julian.maurice@biblibre.com> --- (In reply to Jonathan Druart from comment #7)
The performances are good, I guess it helps to avoid 1 object creation (::Escaped::HTML) by variable.
It's actually worse than that. Template::Stash::AutoEscaping creates an object for each string concatenation, and Template::Toolkit concatenates stuff to its internal buffer all the time. I ran benchmark_AutoEscaping.pl (using Template::Stash::AutoEscaping) with NYTProf and it spends most of the time in Template::Stash::AutoEscaping::Escaped::Base::concat (63% of total time) where it creates 50000 new objects. But apparently most of the time here is spent doing simple string concatenation. (not so) fun fact: the "HTML-escaping" process represents less than 3% of concat in terms of time spent. I don't know how (or if) this can be improved, but I think the time loss is not acceptable, and unless we find a better solution we should keep using html filter manually (and probably add a rule in coding guidelines) Note that we can use TT filters as blocks, like this: [% FILTER html %] [% this_will_be_escaped %] and [% this.will(be).escaped | too %] [% END %] Maybe this could reduce the hassle of writing "|html" everywhere -- You are receiving this mail because: You are watching all bug changes.