NativeScript / android

NativeScript for Android using v8
https://docs.nativescript.org/guide/android-marshalling
Apache License 2.0
519 stars 135 forks source link

feat: native timer polyfills #1733

Closed edusperoni closed 1 year ago

edusperoni commented 1 year ago

This adds a very complete timer polyfill that follows closely the chromium implementation.

Still needs unit testing, I'll add some before merge

jarmani commented 1 year ago

@edusperoni Hello ! Out of curiosity, what is the main advantage comparing to the current implementation ? This will be also implemented in the iOS runtime ?

edusperoni commented 1 year ago

@jarmani yes, I intend to do a similar implementation on the iOS side.

The main advantage is that it's 2-4x faster for scheduling and firing callbacks as it doesn't hit the JNI bridge anymore. Additionally, in my tests the current timeout will freeze the app scheduling a huge amount of timeouts (like 1e5), which doesn't happen on this implementation.

jarmani commented 1 year ago

@edusperoni Amazing, thanks for the explanation !