Why NodeJS store source code in memory? #5049
Answered by
bnoordhuis
Mar 8, 2023
Replies: 0 comments 3 replies
|
It's pretty much required by the language. Calling SpiderMonkey (the JS engine in Firefox) at one time reconstructed the source text from bytecode but that had so many bugs and edge cases, it never really worked right. They eventually gave up trying to make it work and switched to retaining source in memory, just like all other major JS engines. |
0 replies
Answer selected by
Luchanso
|
@bnoordhuis thank you for answer, maybe there is a way to delete or disable this behavior? (for experiments) |
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment


It's pretty much required by the language. Calling
.toString()on a function must return the source text.SpiderMonkey (the JS engine in Firefox) at one time reconstructed the source text from bytecode but that had so many bugs and edge cases, it never really worked right.
They eventually gave up trying to make it work and switched to retaining source in memory, just like all other major JS engines.