Bugzilla – Attachment 76231 Details for
Bug 20975
Improve auto escaping performance
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
AutoEscaping - TT html filters
AutoEscaping---TT-html-filters.patch (text/plain), 3.19 KB, created by
Jonathan Druart
on 2018-06-21 14:03:46 UTC
(
hide
)
Description:
AutoEscaping - TT html filters
Filename:
MIME Type:
Creator:
Jonathan Druart
Created:
2018-06-21 14:03:46 UTC
Size:
3.19 KB
patch
obsolete
>From 8e165e12797c5979a03c3319969bccf5d941ee43 Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >Date: Wed, 20 Jun 2018 17:17:43 -0300 >Subject: [PATCH] AutoEscaping - TT html filters > >for x in 1 2 3 4 5; do time perl benchmark_AutoEscaping.pl; done >perl benchmark_AutoEscaping.pl 0.30s user 0.09s system 95% cpu 0.414 total >perl benchmark_AutoEscaping.pl 0.27s user 0.02s system 97% cpu 0.295 total >perl benchmark_AutoEscaping.pl 0.28s user 0.02s system 99% cpu 0.307 total >perl benchmark_AutoEscaping.pl 0.30s user 0.02s system 98% cpu 0.320 total >perl benchmark_AutoEscaping.pl 0.27s user 0.02s system 99% cpu 0.290 total > >https://bugs.koha-community.org/show_bug.cgi?id=20975 >--- > C4/Templates.pm | 2 ++ > benchmark_AutoEscaping.pl | 2 +- > koha-tmpl/intranet-tmpl/prog/en/modules/intranet-main.tt | 6 ++++++ > mainpage.pl | 9 +++++++++ > 4 files changed, 18 insertions(+), 1 deletion(-) > >diff --git a/C4/Templates.pm b/C4/Templates.pm >index 343a374199..806f5dc189 100644 >--- a/C4/Templates.pm >+++ b/C4/Templates.pm >@@ -5,6 +5,7 @@ use warnings; > use Carp; > use CGI qw ( -utf8 ); > use List::MoreUtils qw/ any uniq /; >+use Template::Stash::AutoEscaping; > > # Copyright 2009 Chris Cormack and The Koha Dev Team > # >@@ -72,6 +73,7 @@ sub new { > COMPILE_DIR => $use_template_cache ? C4::Context->config('template_cache_dir') : '', > INCLUDE_PATH => \@includes, > FILTERS => {}, >+ STASH => Template::Stash::AutoEscaping->new, > ENCODING => 'UTF-8', > } > ) or die Template->error(); >diff --git a/benchmark_AutoEscaping.pl b/benchmark_AutoEscaping.pl >index 63b258d9bd..6ff8a174e0 100644 >--- a/benchmark_AutoEscaping.pl >+++ b/benchmark_AutoEscaping.pl >@@ -31,7 +31,7 @@ __DATA__ > [% pouet %] > <div style="display:none;"> > [% FOR l IN loop %] >- [% l.foo %] [% l.bar %] >+ [% l.foo | html %] [% l.bar | html %] > <br/> > [% END %] > </div> >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/intranet-main.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/intranet-main.tt >index 8a97473edc..9758aafb8d 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/intranet-main.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/intranet-main.tt >@@ -34,6 +34,12 @@ > </div><!-- /koha-news --> > [% END %] > </div> <!-- /.col-sm-2 --> >+ <div style="display:none;"> >+ [% FOR l IN loop %] >+ [% l.foo %] [% l.bar %] >+ <br/> >+ [% END %] >+ </div> > <div class="col-sm-9"> > <div class="row"> > <div class="col-xs-6"> >diff --git a/mainpage.pl b/mainpage.pl >index da6aaee924..4bdeaec2e3 100755 >--- a/mainpage.pl >+++ b/mainpage.pl >@@ -44,6 +44,15 @@ my ( $template, $loggedinuser, $cookie, $flags ) = get_template_and_user( > } > ); > >+my @loop; >+for my $i ( 0 .. 10000 ) { >+ push @loop, { >+ foo => 'my foo', >+ bar => 'my bar', >+ }; >+} >+$template->param( loop => \@loop ); >+ > my $homebranch; > if (C4::Context->userenv) { > $homebranch = C4::Context->userenv->{'branch'}; >-- >2.11.0
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 20975
:
76230
| 76231 |
76232
|
76233
|
76234
|
76235