https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=29672 --- Comment #18 from Julian Maurice <julian.maurice@biblibre.com> --- (In reply to David Cook from comment #16)
1) Why does get_enabled_plugins return the array rather than an array reference? (I suppose it might not matter much since the array will just be a list of references itself, but it just seems less efficient.) Is it really less efficient ? We have to de-reference the list at some point to iterate over it anyway. I will be happy to change that if you can show that it impacts performance.
2) Each Koha::Plugins->call() loops through the plugin list checking the methods available. If there is a large plugin list, this will scale linearly and be progressively slower. It only calls 'can' in the loop. How many calls to 'can' does it take to slow down Koha ? I tested this and on my laptop 5000 'can' calls on a DateTime object takes 1ms. Which sane person would install 5000 Koha plugins ? :) And if they do, that 1ms lost here is not what I would worry about.
Since we're already looping through the plugins in get_enabled_plugins, it could be a good idea to do that method check at the same time and build a hash map of methods to plugins. (The downside is that you'd have to pre-check all methods rather than lazily check just the methods you're demanding at method call time, but that expense would be 1 time rather than N times.) And most of the time 95% of the methods pre-checked won't be used until the next pre-check. That is wasted time IMO. I'm not sure if this would be an improvement.
-- You are receiving this mail because: You are watching all bug changes.