[Bug 15968] New: Unnecessary loop in C4::Templates
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=15968 Bug ID: 15968 Summary: Unnecessary loop in C4::Templates Change sponsored?: --- Product: Koha Version: master Hardware: All OS: All Status: ASSIGNED Severity: normal Priority: P5 - low Component: Architecture, internals, and plumbing Assignee: jonathan.druart@bugs.koha-community.org Reporter: jonathan.druart@bugs.koha-community.org QA Contact: testopia@bugs.koha-community.org
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. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=15968 Jonathan Druart <jonathan.druart@bugs.koha-community.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|ASSIGNED |Needs Signoff -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=15968 --- Comment #1 from Jonathan Druart <jonathan.druart@bugs.koha-community.org> --- Created attachment 48617 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=48617&action=edit 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. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=15968 Jonathan Druart <jonathan.druart@bugs.koha-community.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Blocks| |15342 Referenced Bugs: https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=15342 [Bug 15342] Performance 3.22 - Omnibus -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=15968 Frédéric Demians <frederic@tamil.fr> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Needs Signoff |Signed Off -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=15968 Frédéric Demians <frederic@tamil.fr> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #48617|0 |1 is obsolete| | --- Comment #2 from Frédéric Demians <frederic@tamil.fr> --- Created attachment 48633 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=48633&action=edit 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) -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=15968 Marcel de Rooy <m.de.rooy@rijksmuseum.nl> changed: What |Removed |Added ---------------------------------------------------------------------------- Patch complexity|--- |Small patch Status|Signed Off |Passed QA -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=15968 Marcel de Rooy <m.de.rooy@rijksmuseum.nl> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #48633|0 |1 is obsolete| | --- Comment #3 from Marcel de Rooy <m.de.rooy@rijksmuseum.nl> --- Created attachment 48676 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=48676&action=edit 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> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=15968 Marcel de Rooy <m.de.rooy@rijksmuseum.nl> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |m.de.rooy@rijksmuseum.nl QA Contact|testopia@bugs.koha-communit |m.de.rooy@rijksmuseum.nl |y.org | --- Comment #4 from Marcel de Rooy <m.de.rooy@rijksmuseum.nl> --- Great test plan :) And the speed is back ! -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=15968 Brendan Gallagher <brendan@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Passed QA |Pushed to Master CC| |brendan@bywatersolutions.co | |m --- Comment #5 from Brendan Gallagher <brendan@bywatersolutions.com> --- Pushed to Master - Should be in the May 2016 release. Thanks! -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=15968 Julian Maurice <julian.maurice@biblibre.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Pushed to Master |Pushed to Stable CC| |julian.maurice@biblibre.com --- Comment #6 from Julian Maurice <julian.maurice@biblibre.com> --- Patch pushed to 3.22.x, will be in 3.22.5 -- You are receiving this mail because: You are watching all bug changes.
participants (1)
-
bugzilla-daemon@bugs.koha-community.org