Prepack is yet another tool that aims to compile JavaScript to equivalent JavaScript code. But unlike Babel or Uglify, Prepack isn’t focused on new features or code size.
Instead, Prepack lets you write normal JavaScript code, and outputs equivalent JavaScript code that runs faster.
Automatic code optimization at the source code level… what will they think of next?
LikeLike
Can’t tell if you’re being sarcastic there.
Reading the article makes me think it’s still very early in its development. Also that a lot of potential optimisation could come from referentially transparent code being expanded directly in place rather than being called.
LikeLike
John Hardy Turnbull delenda est
Well, I am not being sarcastic, although I do find it amusing.
It sort of reminds me of the stories I read about the very early days of computing where where Lisp was used to generate assembler code. Except this time its JavaScript generating “lower-level” JavaScript.
I can see how this might be instructive to programmers like me who don’t know about all of JavaScript’s pitfalls and would likely write some very inefficient code. That said, if I were ever tasked with writing a JavaScript program, I would first just try to use TypeScript, expand the code to JavaScript and deliver that expanded code instead.
LikeLike
I hope it’s a good product
LikeLike
Personally Ramin Honary I think you would instinctively write better code because you would write it more functionally and with less wide ranging mutation of state. That would tend to make it easier to analyse and less stateful code should be more easily refactored and optimised.
LikeLike