Bugzilla – Attachment 48633 Details for
Bug 15968
Unnecessary loop in C4::Templates
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 15968: Unnecessary loop in C4::Templates
Bug-15968-Unnecessary-loop-in-C4Templates.patch (text/plain), 1.43 KB, created by
Frédéric Demians
on 2016-03-03 16:29:42 UTC
(
hide
)
Description:
Bug 15968: Unnecessary loop in C4::Templates
Filename:
MIME Type:
Creator:
Frédéric Demians
Created:
2016-03-03 16:29:42 UTC
Size:
1.43 KB
patch
obsolete
>From fd18851ed612355e784758ed06603e3dd6d7294b Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >Date: Thu, 3 Mar 2016 11:35:14 +0000 >Subject: [PATCH] Bug 15968: Unnecessary loop in C4::Templates >MIME-Version: 1.0 >Content-Type: text/plain; charset=UTF-8 >Content-Transfer-Encoding: 8bit > >From C4::Templates::output > > # add variables set via param to $vars for processing > for my $k ( keys %{ $self->{VARS} } ) { > $vars->{$k} = $self->{VARS}->{$k}; > } > >This loop is not necessary, we could do the same with > > $vars = { %$vars, %{ $self->{VARS} } }; > >After a quick benchmark, it gains 100 microseconds when we pass 170 vars >to the template. > >Test plan: >Do some clicks on the interface, everything should be ok. > >Signed-off-by: Frédéric Demians <f.demians@tamil.fr> > Perl idiosyncratic way of merging hash, clearer, if not quicker (not > verified) >--- > C4/Templates.pm | 4 +--- > 1 file changed, 1 insertion(+), 3 deletions(-) > >diff --git a/C4/Templates.pm b/C4/Templates.pm >index 4f23dc7..b3d7edf 100644 >--- a/C4/Templates.pm >+++ b/C4/Templates.pm >@@ -112,9 +112,7 @@ sub output { > C4::Context->preference('opaclayoutstylesheet'); > > # add variables set via param to $vars for processing >- for my $k ( keys %{ $self->{VARS} } ) { >- $vars->{$k} = $self->{VARS}->{$k}; >- } >+ $vars = { %$vars, %{ $self->{VARS} } }; > > my $data; > binmode( STDOUT, ":utf8" ); >-- >2.7.1
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 15968
:
48617
|
48633
|
48676