Closed aurimasc closed 2 years ago
Verified as fixed.
I've not encountered anything that seemed like a fauty behaviour: • Tested different types of notifications and their build speed • Used various Android devices to see if notifications arrive, are not slow to be created, and visually appear as they should
Also tested on runs with 100 notifications being queued. In all cases, the changes made notification building quicker by a sizeable amount of time:
The thing in this PR is performance. JNI calls are expensive and scheduling a notification is way too costly at the moment. This PR addresses the C#<->Java interop part of the problem. Setting up Notification.Builder takes milliseconds of time (low single digit figure, but that's still huge time). The main problem is that when using AndroidJavaObject we actually invoke Java code where reflection is used to find the method to invoke (there is some cashing there). In latest Unity we have improvement in the area where we can call method via jmethodID, a significant shortcut. Tested on 3 different devices and in all cases I see a fairly consistent ~3x improvement for creating and setting up Notification.Builder on 22.2 (didn't measure older versions, but on average should also be better due to not calling Java for no reason, like to set the value that is already the default).
Testing done:
Request for QA: