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
The following snippet includes a set of example calls to native/global APIs (modules? globals objects? not sure what do you call them - Number, Math, Array), and a few simple expressions (equality check, and some multiplication) for comparison:
Version
29.7.0
Steps to reproduce
The following snippet includes a set of example calls to native/global APIs (modules? globals objects? not sure what do you call them -
Number
,Math
,Array
), and a few simple expressions (equality check, and some multiplication) for comparison:Running with plain NodeJS yields results within a few ms:
Running with jest however yields significant performance drawbacks for the native objects:
This happens even when transformation and code coverage is explicitly disable via jest config:
Expected behavior
I expect
Number.isNaN
and other native APIs to run as usualActual behavior
Number.isNaN
and other native APIs are ~20x slower within jest runtimeAdditional context
I tried jest versions all the way down to jest@12, as well as [email protected], no change.
Profiling hints at
_execModule
injest-runtime
(that is, ifnode --prof
captures the correct process):Assigning for example
Number.isNaN
to a variable and calling instead that make the code execute fast again:Environment
The text was updated successfully, but these errors were encountered: