Why NodeJS store source code in memory? #46990
-
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 1 reply
-
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. |
Beta Was this translation helpful? Give feedback.
-
@bnoordhuis thank you for answer, maybe there is a way to delete or disable this behavior? (for experiments) |
Beta Was this translation helpful? Give feedback.
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.