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>
This commit is contained in:
Jonathan Druart 2016-03-03 11:35:14 +00:00 committed by Brendan A Gallagher
parent 59bef628b6
commit 9be221b14e
1 changed files with 1 additions and 3 deletions

View File

@ -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" );