Join GitHub today
GitHub is home to over 20 million developers working together to host and review code, manage projects, and build software together.
Reusing the event handler call optimization for array of handlers #2440
I noticed that you have an optimization for calling handlers if there are 0 to 2 arguments. But this optimization is not used if there is an array of handlers. Therefore, I moved the optimization code to a separate function. I am assuming that a function call is more efficient than the argument computation (not verified this). If not, an alternative is to flatten this code and remove the callHandler function.
I do agree that this is a very important piece of code. I just wanted to suggest a change and instead of merely suggesting it as a comment, I thought it is better to send you the code.
This comment has been minimized.
This comment has been minimized.Show comment Hide comment
It's possible that not all tests pass, especially on the master branch. The rule of thumb is that tests that pass before should keep on passing after applying your patch, while failing tests should fail for the same reason.
@AndreasMadsen already mentioned it, this patch needs a benchmark (covering all the common cases) to prove it doesn't introduce performance regressions.