-
Notifications
You must be signed in to change notification settings - Fork 29.1k
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
Regex performance differences AMD64 vs ARM64 #51724
Comments
The regex is part of the ECMAScript, thus the performance is caused by v8 rather than node You can test that when using d8 to check if that happens in v8 as well |
FYI @nodejs/v8 |
It does happen on d8. On a Macbook with M2 chip (Arm64), I am able to compile for x64 and for Arm64. When profiling:
|
If so, than there is nothing much for us to do, you can open an issue in v8 issue tracking page |
This should be mitigated by v8/v8@07ee5d4 ; I think the mainline branch will see the fix after the next Chrome release, but wanted to leave the fix hash around on this issue if backports to other active branches are desirable. |
Version
v18.19.0/ v20.11.0/v21.6.1
Platform
Amazon Linux 2023 - Architecture: 64-bit (x86) and 64-bit (Arm)
Subsystem
No response
What steps will reproduce the bug?
I have created a Gist here.
Run
node regex-issue.js
How often does it reproduce? Is there a required condition?
Always
What is the expected behavior? Why is that the expected behavior?
On an Amazon Linux 2023 machine with 64-bit (x86) architecture, this code takes less than 100 milliseconds.
What do you see instead?
On an Amazon Linux 2023 machine with 64-bit (arm) architecture, this code takes more than 2 seconds to run.
As the complexity of the regex pattern grows, the performance difference of running in ARM64 and AMD64 becomes even larger.
Additional information
I have tested this behavior in multiple node versions and it happens in all of them (check the Version section).
I am also able to replicate this on a MacBook with M2 chip (Arm64 architecture), which also takes more than 1.5 seconds to run.
The text was updated successfully, but these errors were encountered: