Hacker News new | past | comments | ask | show | jobs | submit login

Is there a way to provide v8 with compiled code instead of unparsed JS?



While it isn’t exactly what you’re looking for, this is the closest thing I’m aware of for pure JS: 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.


Thanks. I was thinking more about desktop apps (Elecron, CEF, etc).


Isn’t that what Web Assembly (WASM) is attempting to do? It’s a bytecode, not machine code, so it’s processor agnostic too.


I 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.


How many times?


According to the fine article, twice in three days.




Consider applying for YC's Summer 2025 batch! Applications are open till May 13

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: