Live data from Hacker News

Prepack helps make JavaScript code more efficient

prepack.io

1–10 of 233 posts

Re: Prepack helps make JavaScript code more efficient

#2
Looks like it's applying the same sort of optimizations a normal optimizing compiler would.

With all of these JS "compilers" and transpilers, at some point, it just makes sense to build a client-side language in the browser that compiles down to native and runs sandboxed.

I'm excited for WebAssembly, but I realize that, like with all shiny new web things (for example, WebRTC on Safari/iOS), mainstream browsers that most people/users actually have installed on their computers/devices and use won't support it for another 3-5 years.

Meanwhile, the everyday JS coder wants to use ES7 from last year but has to settle for the bandaid solution of Babel because the browsers aren't going to be ready for it yet.

Google's Native Client had the right idea but never quite took off (nor was it ever adopted by anybody else): https://static.googleusercontent.com/media/research.google.c...

This type of working solution would also stave off the Electron-ification of desktop apps (which means an effective halving of my laptop battery life, spinning up wasted CPU cycles -- like 13% being spent on rendering a blinking cursor, and reducing my computer's RAM by a factor of eight as just about everything I run on my computer now is its own separate bloated Chrome instance -- Slack, Atom, VSCode, Skype, Telegram, Discord, Spotify, ...).

EDIT: Facebook employees, please stop downvoting my quality content. It is getting tiresome.

Re: Prepack helps make JavaScript code more efficient

#3
The existence of this project says that JS is supposed to be taken as a very serious programming language now. But what, exactly, is it that is so serious that JS can be used for, which will start making hardcore developer's minds see its unlimited possibilities, as a deeply systematic runtime environment?

I'm saying its something like: https://linuxontheweb.appspot.com/about

Re: Prepack helps make JavaScript code more efficient

#4
This looks cool, but is it doing anything that an engine like V8 doesn't already do? Since the JS still isn't actually compiled the browser engine still parses everything and does its own optimizations. Are there some benchmarks showing actual speed improvements?

Re: Prepack helps make JavaScript code more efficient

#6

Looks like it's applying the same sort of optimizations a normal optimizing compiler would. With all of these JS "compilers" and transpilers, at some point, it just makes sense to build a client-side language in the browser that compiles down to native and runs sandboxed. I'm excited for WebAssembly, but I realize that, like with all shiny new web things (for example, WebRTC on Safari/iOS), mainstream browsers that m…

Prepack is quite complementary to traditional compilers. It's strength is that it comes with full knowledge of the JavaScript built-ins, and it uses that to pre-evaluate the code at compile time. In an extreme case, an entire program can get reduced to the final result.

Re: Prepack helps make JavaScript code more efficient

#7

Looks like it's applying the same sort of optimizations a normal optimizing compiler would. With all of these JS "compilers" and transpilers, at some point, it just makes sense to build a client-side language in the browser that compiles down to native and runs sandboxed. I'm excited for WebAssembly, but I realize that, like with all shiny new web things (for example, WebRTC on Safari/iOS), mainstream browsers that m…

I was right there a year or two ago developing portable native client things for my project, Linux on the Web (I was able to get vim and python running).

Projects like that can pioneer a whole lot of new techniques and infrastructure that can be very easily applied to whatever technology is eventually going to win out.

Re: Prepack helps make JavaScript code more efficient

#9
The examples are very far from the JS I see and read, but this is definitely a very useful tool. It seems like gcc -Olevel. It would be interesting to incorporate some sort of tailoring for JS engines into this, like how a compiler might try to make x86-specific optimizations. For example, if you know your target audience mostly runs Chrome (or if the code is to be run by node), you might apply optimizations to change the code to be more performant on V8 (see https://github.com/petkaantonov/bluebird/wiki/Optimization-k... for example).

I love it and can't wait to use it on some projects!

Post reply on HN