-
-
Notifications
You must be signed in to change notification settings - Fork 33.4k
src: enable libm trig functions in V8 #60153
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
base: main
Are you sure you want to change the base?
Conversation
Review requested:
|
This comment was marked as outdated.
This comment was marked as outdated.
Should provide better performance on some platforms.
34e8bf7
to
e02de4a
Compare
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
just a note of interest... several years ago I tried applying libm optimizations to some operations in V8 (though, not the trig functions) and we eventually found the output to be bad enough in certain cases to necessitate reverting it. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@targos ... that's why I wanted to be sure to tag you here ... :-) ... it definitely seemed to have an impact locally but I couldn't quite figure out if it was completely wired in correctly. What additional changes do you think would be necessary? |
Don't we have a 37% gain in one case ? Or do I misread what @jasnell posted? |
That was what I saw locally but it's possible something else is happening there. Need to be certain |
We would need to port at least: Lines 207 to 208 in f0aa073
Lines 1417 to 1419 in f0aa073
This should go in https://github.com/nodejs/node/blob/f0aa073907fc88f64ca95e4821eb7fdf49b133e2/tools/v8_gypfiles/features.gypi, similar to many other build flags with a variable declaration at the top and a new condition for the define. And possibly: Lines 6930 to 6932 in f0aa073
Lines 6937 to 6957 in f0aa073
This is less trivial. We don't have |
@targos ... yeah, that's pretty much what I suspected but was taking the optimistic approach initially ;-) ... If this is going to require the |
Should provide better performance on some platforms.
Context: @t3dotgg put together some benchmarks that show the trig functions running in node.js aren't as fast as they could be. We did some digging and think this may help. https://github.com/t3dotgg/cf-vs-vercel-bench/blob/main/vanilla-bench/vercel-edition/api/
There's a possibility this won't work on all platforms/archs so running some tests in CI to verify first.Appears to be fine in CI!/cc @nodejs/v8