Bug 6000

Summary: Performance enhancements for C4::Context and C4::Languages
Product: Koha Reporter: Chris Cormack <chris>
Component: Architecture, internals, and plumbingAssignee: Paul Poulain <paul.poulain>
Status: CLOSED WONTFIX QA Contact: Bugs List <koha-bugs>
Severity: enhancement    
Priority: PATCH-Sent (DO NOT USE) CC: paul.poulain, tomascohen
Version: master   
Hardware: All   
OS: All   
Change sponsored?: --- Patch complexity: ---
Documentation contact: Documentation submission:
Text to go in the release notes:
Version(s) released in:
Bug Depends on:    
Bug Blocks: 5999, 6193, 7119    
Attachments: Proposed Patch
Followup patch
Bug 6000 : Performance enhancing

Description Chris Cormack 2011-03-29 23:00:43 UTC

    
Comment 1 Chris Cormack 2011-03-29 23:03:40 UTC
This probably needs a decent amount of testing.
Comment 2 Chris Cormack 2011-03-29 23:04:12 UTC Comment hidden (obsolete)
Comment 3 Chris Cormack 2011-03-29 23:07:04 UTC Comment hidden (obsolete)
Comment 4 Paul Poulain 2011-10-24 11:38:13 UTC
Updating Version : This ENH will be for Koha 3.8
Comment 5 Paul Poulain 2011-10-25 15:05:47 UTC
Bug versionned for master. entries will be made against rel_3_8 once the patch has been applied (see thread about that on koha-devel yesterday)
Comment 6 Tomás Cohen Arazi 2012-01-04 13:13:09 UTC
I think we need to define a new helper routine in Context.pm that returns the whole preferences, and memoize that one. The way it is now memoize wont help.

I'll send to HDL a proposal.
Comment 7 Tomás Cohen Arazi 2012-01-04 16:07:46 UTC
Created attachment 7037 [details] [review]
Bug 6000 : Performance enhancing

C4::Context.pm
Loads all systempreferences at once
And uses Memcached to cache them

C4::Languages
Using List::MoreUtils
Memcaching get_langage_description

Bug 6000 : Follow up Performance enhancing : C4/Languages.pm

removing a call unused to getAllLanguages
Doing better job at enabled languages

Bug 6000: Rebase against origin/master + 6193
Comment 8 Julian Maurice 2012-01-04 16:15:06 UTC
In reply to comment 7

With this code:

> my $oldsyspref = C4::Context->preference('SYSPREF');
> C4::Context->set_preference('SYSPREF', 'newvalue');
> my $newsyspref = C4::Context->preference('SYSPREF');

What is the value of $newsyspref, if C4::Context->preference is memoized ?
Comment 9 Tomás Cohen Arazi 2012-01-04 16:19:23 UTC
(In reply to comment #8)
> In reply to comment 7
> 
> With this code:
> 
> > my $oldsyspref = C4::Context->preference('SYSPREF');
> > C4::Context->set_preference('SYSPREF', 'newvalue');
> > my $newsyspref = C4::Context->preference('SYSPREF');
> 
> What is the value of $newsyspref, if C4::Context->preference is memoized ?

It's a good question for HDL.
I'd personally add a memcached->remove('SYSPREF') in the set_preference routine.
Comment 10 Tomás Cohen Arazi 2012-01-04 16:22:25 UTC
(In reply to comment #8)

Please read comment #6 as I proposed doing it other way, this time I just rebased against origin/master + 6193 (to be signed off patch). I'm willing to discuss how to implement this on IRC.
Comment 11 Paul Poulain 2012-02-03 10:03:15 UTC
Setting "in discussion", as other caching-related bugs
Comment 12 Paul Poulain 2012-02-21 12:26:54 UTC
This patch does not apply now that bug 6193 has been applied. And I think this entry should be dropped in favour of some more granular entries.
Marking "failed QA", and I suggest we "abandon" this one