- πΊπΈUnited States nicxvan
Do you have examples of the types of hooks for each?
- π©πͺGermany donquixote
Looking at ->invokeAll() calls, here are some examples for the most common types.
No return value:
hook_cache_flush()
hook_rebuild()
hook_(entity|ENTITY_TYPE)_(presave|insert|update|predelete|delete|revision_create)()
hook_entity_bundle_create()
hook_entity_bundle_delete()Merge:
hook_updater_info()
hook_filetransfer_info()
hook_requirements()
hook_update_requirements()
hook_entity_preload()
hook_(entity|ENTITY_TYPE)_(access|create_access)()
hook_field_info_max_weight()
hook_entity_extra_field_info()
hook_entity_operation()We could investigate if these all need the same merge logic.
I am looking at ->invokeAllWith() calls now.. - π©πͺGermany donquixote
The most obvious first step here would be a dedicated logic for hooks with no return value and regular passing of parameters, so the first group in my previous comment.
I am not sure how much improvement this would bring, seems like a micro optimization.
If we only measure the raw overhead from the module handler, it will make a difference. If we measure total request time it will be overshadowed by other things. - π©πͺGermany donquixote
And yes this part still applies with the new event hook system.
- π©πͺGermany donquixote
Actually, if we inline most of the stuff in invokeAll() we probably get some improvement.
We can do this in the other issue π Optimize ModuleHandler::invokeAll() Active .
Perhaps the remaining benefit from separate methods per return value behavior would have diminishing returns after that other optimization.