Summary: | Optimize Koha::Plugins::GetPlugins | ||
---|---|---|---|
Product: | Koha | Reporter: | Julian Maurice <julian.maurice> |
Component: | Plugin architecture | Assignee: | Julian Maurice <julian.maurice> |
Status: | CLOSED FIXED | QA Contact: | Testopia <testopia> |
Severity: | enhancement | ||
Priority: | P5 - low | CC: | david, fridolin.somers |
Version: | Main | ||
Hardware: | All | ||
OS: | All | ||
See Also: | https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=29672 | ||
Change sponsored?: | --- | Patch complexity: | --- |
Documentation contact: | Documentation submission: | ||
Text to go in the release notes: | Version(s) released in: | ||
Circulation function: | |||
Bug Depends on: | |||
Bug Blocks: | 7923 | ||
Attachments: |
Bug 28172: [DO NOT PUSH] Test script for GetPlugins
Bug 28172: Optimize Koha::Plugins::GetPlugins Bug 28172: [DO NOT PUSH] Test script for GetPlugins Bug 28172: Optimize Koha::Plugins::GetPlugins |
Description
Julian Maurice
2021-04-20 07:15:02 UTC
Created attachment 119870 [details] [review] Bug 28172: [DO NOT PUSH] Test script for GetPlugins Created attachment 119871 [details] [review] Bug 28172: Optimize Koha::Plugins::GetPlugins Instead of doing one SQL query for retrieving a list of plugin classes (filtered or not by a method name) + one SQL query for each loaded plugin (to look up the 'enabled' status), we can do a single SQL query, fetching only enabled plugins, and do the method check using `can`. It allows to use the Module::Load::Conditional cache when requesting only enabled modules, which gives a great performance boost Also, call get_metadata only if needed Test plan: 1. Make sure you have some plugins enabled 2. Apply the 1st patch ("Test script for GetPlugins") 3. Run the test script several times, copy each result into a file A 4. Apply the other patch(es) 5. Run the test script several times, copy each result into another file B 6. Compare the results. Times in file B should be smaller than in file A Without the patch: % ./test_getplugins.pl 2 plugins detected, 2 enabled First 2 calls to GetPlugins: 0.533s 1000 calls to GetPlugins: 3.505s 1000 calls to GetPlugins with method = "unknown_method": 0.824s 1000 calls to GetPlugins with all = 1: 3.580s With the patch: % ./test_getplugins.pl 2 plugins detected, 2 enabled First 2 calls to GetPlugins: 0.535s 1000 calls to GetPlugins: 1.502s 1000 calls to GetPlugins with method = "unknown_method": 0.730s 1000 calls to GetPlugins with all = 1: 3.795s The patch no longer applies :-(.. Arf not a trivial rebase. I leave it to Julian ;) Created attachment 142917 [details] [review] Bug 28172: [DO NOT PUSH] Test script for GetPlugins Created attachment 142918 [details] [review] Bug 28172: Optimize Koha::Plugins::GetPlugins Instead of doing one SQL query for retrieving a list of plugin classes (filtered or not by a method name) + one SQL query for each loaded plugin (to look up the 'enabled' status), we can do a single SQL query, fetching only enabled plugins, and do the method check using `can`. It allows to use the Module::Load::Conditional cache when requesting only enabled modules, which gives a great performance boost Also, call get_metadata only if needed Test plan: 1. Make sure you have some plugins enabled 2. Apply the 1st patch ("Test script for GetPlugins") 3. Run the test script several times, copy each result into a file A 4. Apply the other patch(es) 5. Run the test script several times, copy each result into another file B 6. Compare the results. Times in file B should be smaller than in file A Rebased on master, but now when running the test script I get a really bad time for "1000 calls to GetPlugins with all = 1". As bug 29672 changes Koha::Plugins::call so that it does not use GetPlugins, I'm not sure if this patch is still relevant. (In reply to Julian Maurice from comment #8) > Rebased on master, but now when running the test script I get a really bad > time for "1000 calls to GetPlugins with all = 1". > > As bug 29672 changes Koha::Plugins::call so that it does not use GetPlugins, > I'm not sure if this patch is still relevant. Hi Julian, should we close this now that bug 29672 is pushed? Changed status - fixed on bug 29672. |