Bugzilla – Attachment 45535 Details for
Bug 15341
Performance - Retrieve all sysprefs at once
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 15341: Retrieve all sysprefs at once
Bug-15341-Retrieve-all-sysprefs-at-once.patch (text/plain), 2.07 KB, created by
Jonathan Druart
on 2015-12-09 15:35:02 UTC
(
hide
)
Description:
Bug 15341: Retrieve all sysprefs at once
Filename:
MIME Type:
Creator:
Jonathan Druart
Created:
2015-12-09 15:35:02 UTC
Size:
2.07 KB
patch
obsolete
>From 5e6b3a1ec78fedb8634717d58297b063b2846757 Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >Date: Wed, 9 Dec 2015 15:18:08 +0000 >Subject: [PATCH] Bug 15341: Retrieve all sysprefs at once > >C4::Context->preference generates a call to Koha::Config::SysPrefs->find >for all different sysprefs we are searching for. >It seems to be a performance killer and be better to retrieve them all >together. > >I have enabled general_log in the MariaDB config file, the GET >circ/circulation.pl?borrowernumber=42 >There are 293 queries of the following form: > SELECT me.variable, me.value, me.options, me.explanation, me.type FROM > systempreferences me WHERE ( me.variable = 'MY_SYSPREF' ) > >Then benchmarking before and after this patch (using plackup, and the >misc/plack/koha.psgi file with Profiler::NYTProf enabled): > >Before: >Profile of /home/koha/perl5/bin/plackup for -2.07s (of 616ms), executing >158857 statements and 588479 subroutine calls in 427 source files and 73 >string evals. >885 174ms 4.03s C4::Context::preference > >After: >Profile of /home/koha/perl5/bin/plackup for -1.70s (of 349ms), executing >94273 statements and 397525 subroutine calls in 437 source files and 79 >string evals. >1138 194ms 1.99s C4::Context::preference >(calls) (exclusive time) (inclusive time) > >Could someone confirm that? >--- > C4/Context.pm | 7 ++----- > 1 file changed, 2 insertions(+), 5 deletions(-) > >diff --git a/C4/Context.pm b/C4/Context.pm >index e314f5a..eb685e8 100644 >--- a/C4/Context.pm >+++ b/C4/Context.pm >@@ -525,13 +525,10 @@ sub preference { > if ( defined $ENV{"OVERRIDE_SYSPREF_$var"} ) { > $value = $ENV{"OVERRIDE_SYSPREF_$var"}; > } else { >- my $syspref; >- eval { $syspref = Koha::Config::SysPrefs->find( lc $var ) }; >- $value = $syspref ? $syspref->value() : undef; >+ map { $sysprefs{lc $_->{variable}} = $_->{value} or undef} @{ Koha::Config::SysPrefs->search()->unblessed }; > } > >- $sysprefs{lc $var} = $value; >- return $value; >+ return $sysprefs{lc $var}; > } > > sub boolean_preference { >-- >2.1.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 15341
:
45535
|
56012