-
-
Notifications
You must be signed in to change notification settings - Fork 6.5k
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
Improve process object creation #4955
Conversation
Infinite amount of thanks to @thymikee who identified the offending commit by performing a manual bisection! |
Codecov Report
@@ Coverage Diff @@
## master #4955 +/- ##
==========================================
- Coverage 60.34% 60.29% -0.06%
==========================================
Files 198 198
Lines 6604 6598 -6
Branches 4 3 -1
==========================================
- Hits 3985 3978 -7
- Misses 2619 2620 +1
Continue to review full report at Codecov.
|
Can confirm it's back to the nominal speed on my testing suite 👍 |
Thanks for fixing this issue. I would prefer having a whitelist rather than a blacklist. If the node folks decide to add |
require.main is provided by jestjs/jest#5618.
mainModule is blacklisted by jestjs/jest#4955 and require.main is provided by jestjs/jest#5618, but require.main can't be accessed on electron.
This pull request has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
This PR improves the way the
process
object is created in two ways:Array
s.getOwnPropertyDescriptors
anddefineProperties
.
mainModule
, which contains a reference to the main module, plus all of the other modules loaded so far in memory.The total improvement on a raw Node instance is approximately of 40%; but the improvement grows as the amount of previously loaded modules also grows. In my case, I've been able to observe up to 20x performance by artificially loading a bunch of modules before calling
createProcessObject
.