[Koha-bugs] [Bug 29672] Increase performance of Koha::Plugins->call

bugzilla-daemon at bugs.koha-community.org bugzilla-daemon at bugs.koha-community.org
Fri Jun 3 09:13:20 CEST 2022


https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=29672

--- Comment #19 from David Cook <dcook at prosentient.com.au> ---
(In reply to Julian Maurice from comment #18)
> 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.

It would be less efficient as you're creating a new data structure in memory
and copying the list contents over to it. But the difference is probably
negligible, so I wouldn't worry about it. It just seemed like an odd choice to
me. 

> 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.

I thought that I wrote the same thing earlier but apparently I didn't. Yeah,
"can" would be a very cheap call. No I/O to do. Just a wee bit of CPU time. 

> 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.

In my follow-up comment, I was suggesting that you could actually just fetch
the plugins that support the method you need and cache those plugins without
fetching, instantiating, and caching all the plugins. 

But then you could argue there's not that many plugins, so you could just fetch
them all. No point optimizing until you need to. 

--

In any case, +1 to caching

-- 
You are receiving this mail because:
You are watching all bug changes.


More information about the Koha-bugs mailing list