-
Notifications
You must be signed in to change notification settings - Fork 645
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Array.protoype.indexOf() Performance Regression #1270
Comments
Thank you for reporting this! We can reproduce it and will address it. This is most likely because |
Hi @tmikov , is there a target release for this one? |
React Native releases are not synchronized with Hermes is is hard to predict where anything would land. In any case, this task is open, but we haven't started working on it yet. |
This finding also confirms this if I am not mistaken? If so, #1024 could also get fixed as a consequence of this here issue getting fixed. |
@DerGuteMoritz good point! I hadn't actually realized that. |
Fixed by #1447 |
Bug Description
The
Array.prototype.indexOf()
functions seems to be significantly slower on Hermes when compared to JSC. I first noticed the issue in React Native 0.64 inside the JSTimers file: https://github.com/facebook/react-native/blob/0645c38014e8310d8e387dabc860c8c5878beb6e/Libraries/Core/Timers/JSTimers.js#L62 , however, I have reproduced a case using the Hermes CLI to verify my findings.gradle clean
and confirmed this bug does not occur with JSCHermes git revision (if applicable): release-v0.12? I'm using Hermes CLI with version 0.12.0
React Native version: N/A
OS: macOS Sonoma 14.2.1
Platform (most likely one of arm64-v8a, armeabi-v7a, x86, x86_64): x86_64
Steps To Reproduce
The following code running on Hermes will take significantly longer:
index_of_test.js
:hermes ./index_of_test.js
jsc --useJIT=false ./index_of_test.js
My example seems to indicate that Hermes is much slower at iterating through and comparing Array values when compared to JSC.
Funnily enough, the same test using
Array.prototype.includes()
has similar performance between Hermes and JSC. I would assume (probably incorrectly) that the two functions use a similar algorithm. Although in this case, JSC is also much slower compared to itsindexOf
performance.hermes ~/includes_test.js
jsc --useJIT=false ~/includes_test.js
The Expected Behavior
Hermes performance on
Array.protoype.indexOf()
should be on-par with JSC performance.The text was updated successfully, but these errors were encountered: