5 ms·
Ah yeah, you're right that Deno doesn't have a node_modules, but AFAIU it still downloads dependencies to "somewhere on disk" and then, every time your code run
by stephen 4y ago
Ah yeah, you're right that Deno doesn't have a node_modules, but AFAIU it still downloads dependencies to "somewhere on disk" and then, every time your code runs, it re-evals all of them from scratch.
So, admittedly I was using "node_modules" as a shorthand for "the code that makes up my dependencies", and that AFAIU Deno has not implemented this "use a v8 snapshot to cache preloaded/pre-evald dependencies" optimization.
I.e. I want something like:
https://danheidinga.github.io/Everyone_wants_fast_startup/ https://danheidinga.github.io/Everyone_wants_fast_startup/
- MuffinFlavored 4y agodoes V8 support snapshot + restore?
- CapsAdmin 4y agoYou could maybe load bytecode if that's a thing in javascript to avoid parsing at least, but outside of that you'd have to make sure the environment is actually the same. For example if I define an environment variable and some script deep inside the modules folder reads that variable and does something with it. You'd need to make sure the environment is identical before everything is loaded. There are other things as well like a script defining a global (perhaps for polyfill) and it needs to load before some other script. The Nix package manager is probably a good place to look at how this should be done. However it's all based on strict constraints and other functional principles that I don't think npm packages are anywhere near of satisfying.