-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
Make float16 handling more performant #1379
Conversation
Local tests running could significantly save your time. |
Should I use
|
Yes. With disabling // eslint-disable-next-line no-self-compare -- NaN check
if (value !== value) return value;
Yes. If it will be required, I'll update it later.
|
Stylistically LGTM, current tests passed. I'll think about the logic and whether it's worth adding any more tests. Thanks! |
Hello!
Sorry I'm not really familiar with the code style of core-js -- feel free to modify this PR in any way.
This PR adds methods for packing/unpacking float16 values (instead of those from
internals/ieee754.js
) based on my code from here (roundTiesToEven
function taken frominternals/math-float-round.js
). They should be 100% IEEE754-compliant but are untested (would be great if you could help with that).Packing is appoximately 15-20 times faster on my machine (running on an array of thousand values, ~16K ops/s vs ~900 ops/s) tested with the following JSBench code:
Setup
Original implementation case
New implementation case