You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Would you be interested in seeing a POC version using a 'dynamic code' approach? The concept here would be: at the first attempt to run hooks through HookRelay, we 'precompile' the whole stack of hooks so that less logic needs to be evaluated during the hook call and subsequent calls. Modifying the stack (by (de)registering plugins, etc) would invalidate the cached 'compiled' version.
By preprocessing / 'compiling' the stack we accelerate some of the slower aspects of calling hooks, specifically:
assembling the correct args for each hook's call ( a significant portion of the total overhead, I think)
multiple ifs and nested function calls and their associated attribute lookups
In my local, rough draft implementation, I was able to speedup benchmarks by 10-20% with only a small modification to the current code. More speed improvement is probably possible under this approach.
In some ways, I think, generated code is a great fit for what pluggy wants to do. On the other hand, I'm not sure it is ever a good idea to use it in a real project :P . Any thoughts?
Cython is currently Most likely to create a spedup
Certain refactoring need to be added first tho
Sorry @RonnyPfannschmidt ! That was a terrible explanation. I've taken one more run at it. And, I've moved the discussion to a separate ticket in order to avoid polluting this one (issue #449)
Activity
wahuneke commentedon Sep 26, 2023
Would you be interested in seeing a POC version using a 'dynamic code' approach? The concept here would be: at the first attempt to run hooks through HookRelay, we 'precompile' the whole stack of hooks so that less logic needs to be evaluated during the hook call and subsequent calls. Modifying the stack (by (de)registering plugins, etc) would invalidate the cached 'compiled' version.
By preprocessing / 'compiling' the stack we accelerate some of the slower aspects of calling hooks, specifically:
In my local, rough draft implementation, I was able to speedup benchmarks by 10-20% with only a small modification to the current code. More speed improvement is probably possible under this approach.
In some ways, I think, generated code is a great fit for what pluggy wants to do. On the other hand, I'm not sure it is ever a good idea to use it in a real project :P . Any thoughts?
RonnyPfannschmidt commentedon Sep 26, 2023
It's not quite clear what you mean by that,
Cython is currently Most likely to create a spedup
Certain refactoring need to be added first tho
wahuneke commentedon Sep 27, 2023
Sorry @RonnyPfannschmidt ! That was a terrible explanation. I've taken one more run at it. And, I've moved the discussion to a separate ticket in order to avoid polluting this one (issue #449)