You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Thanks for the report but the slowdown isn't unexpected, it's an inevitable consequence of how the vm module is implemented.
Executive summary: V8 can normally inline and optimize Math method calls but the vm module intercepts all loads and stores from/to the global object, depriving V8 of the possibility of recognizing such built-in methods.
It's why I wrote the vime module years ago, it doesn't suffer from that defect. Closing as a wontfix/cantfix.
Activity
bnoordhuis commentedon Aug 22, 2023
Thanks for the report but the slowdown isn't unexpected, it's an inevitable consequence of how the vm module is implemented.
Executive summary: V8 can normally inline and optimize Math method calls but the vm module intercepts all loads and stores from/to the global object, depriving V8 of the possibility of recognizing such built-in methods.
It's why I wrote the vime module years ago, it doesn't suffer from that defect. Closing as a wontfix/cantfix.
a-parser commentedon Aug 22, 2023
@bnoordhuis, Thanks for the explanation, but I'm not agree with "wontfix".
a-parser commentedon Aug 22, 2023
there is a workaround by localizing Math
but honestly it's looks ugly
a-parser commentedon Aug 22, 2023
related #30709
bnoordhuis commentedon Aug 23, 2023
That's how V8's API works, it's all or nothing. If you feel the documentation is lacking, go ahead and send a pull request.