Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
I was wondering if next/current is faster than foreach. The test
http://sandbox.onlinephpfunctions.com/code/0c1d5b1a723309ce669c1d8348b3617def6d3d6b
shows that foreach is faster than next/current.
Then I've done tests
http://sandbox.onlinephpfunctions.com/code/6323a783b033b0d6b8217336d5f1b358e15d2f47
As a result, a current algorithm is slowest among others.
The algorithm with preparing $handleableHandlers is faster than current, but slower than suggested. However it has more clean code than suggested.
The suggested algorithm is fastest among others and it is more useful in context of logger than more clean code of algorithm with preparation of $handleableHandlers
PS: However tests on http://sandbox.onlinephpfunctions.com shows that algorithm with preparation of $handleableHandlers is fastest. Plus, it has a more clean code. Maybe, it worth to use this one. I'll be glad to read your opinions.