]> git.koha-community.org Git - koha.git/commit
Bug 15968: Unnecessary loop in C4::Templates
authorJonathan Druart <jonathan.druart@bugs.koha-community.org>
Thu, 3 Mar 2016 11:35:14 +0000 (11:35 +0000)
committerFrédéric Demians <f.demians@tamil.fr>
Tue, 15 Mar 2016 08:54:03 +0000 (09:54 +0100)
commite7af53a4dbfcbe02c76dc9ff66281a7aa4ecb5d6
tree87b15758c187c1538d15cc98134cac56774a4c23
parentbab470c7805ccfc6296be1005279add8aa20623a
Bug 15968: Unnecessary loop in C4::Templates

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)

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Brendan A Gallagher <brendan@bywatersolutions.com>
(cherry picked from commit 9be221b14eee137f4143e4a2243eadfb03fcfbbc)
Signed-off-by: Julian Maurice <julian.maurice@biblibre.com>
(cherry picked from commit 1543db81c7e6ba0c8501cf19452ba3d08f842680)
Signed-off-by: Frédéric Demians <f.demians@tamil.fr>
C4/Templates.pm