4 ms·
Is there a way to provide v8 with compiled code instead of unparsed JS?
by pier25 7y ago
Is there a way to provide v8 with compiled code instead of unparsed JS?
- jackcodes 7y agoWhile it isn’t exactly what you’re looking for, this is the closest thing I’m aware of for pure JS: https://prepack.io/ https://prepack.io/ and outside of that o guess you’re looking at WASM, although I know this isn’t exactly what you were asking for. But if your goal is to compile a little closer to v8 then you’d have to set v8 as your compilation target, making that only really worthwhile on the server (since you’d be missing out on all other browser runtimes). I could see such a thing being pretty useful for something CloudFlare workers where startup time is vital, and your execution environment is guaranteed to be v8. Unless of course they’ve managed to always keep them hot.
- pier25 7y agoThanks. I was thinking more about desktop apps (Elecron, CEF, etc).
- ijpoijpoihpiuoh 7y agoI don't know about doing this directly with v8, but when used in the browser, the code will be cached after being compiled a certain number of times.
- pier25 7y agoHow many times?
- ijpoijpoihpiuoh 7y agoAccording to the fine article, twice in three days.
- colejohnson66 7y agoIsn’t that what Web Assembly (WASM) is attempting to do? It’s a bytecode, not machine code, so it’s processor agnostic too.