Closed kirillzyusko closed 2 weeks ago
Current size | Target Size | Difference |
---|---|---|
159580 bytes | 159441 bytes | 139 bytes 📈 |
@kirillzyusko
Thank you for the refactoring! I noticed a small oversight. In that code, the second argument in the eventDispatcher?.let
scope should be it instead of eventDispatcher
for it
to be correct.
📜 Description
In https://github.com/kirillzyusko/react-native-keyboard-controller/pull/681 we started to use reflection for detection the amount of params. But reflection is a slow mechanism, so in this PR I'm optimizing lookup stage by calculating a correct method only one time.
💡 Motivation and Context
Lookup can be up to 10-100 times slower comparing to the direct function call. If we call this method too frequently, we can encounter a bottleneck. To make this code faster I decided to cache the method (thus we do a lookup only one time).
This approach should almost neglect performance impact for a lookup stage. The call stage (method invocation) still will add an overhead, but it should have a small impact.
📢 Changelog
Android
🤔 How Has This Been Tested?
Tested on CI.
📝 Checklist