Every two weeks I send out a newsletter containing lots of interesting stuff for the modern PHP developer. You can expect quick tips, links to interesting tutorials, opinions and packages. Want to learn the cool stuff? Then sign up now!

A tool for making JavaScript code run faster

Even though I’don’t like Facebook as a user, their amazing contributions to open source are something to be very grateful for. Last week they presented their new work in progress: Prepack.

Prepack is a tool that optimizes JavaScript source code: Computations that can be done at compile-time instead of run-time get eliminated. Prepack replaces the global code of a JavaScript bundle with equivalent code that is a simple sequence of assignments. This gets rid of most intermediate computations and object allocations.


It’s still in development, so best not use it in production environments yet.

Freek Van der Herten is a partner and developer at Spatie, an Antwerp based company that specializes in creating web apps with Laravel. After hours he writes about modern PHP and Laravel on this blog. When not coding he’s probably rehearsing with his kraut rock band. He loves waffles and butterflies.
  • bramus

    Hmmz … this one got me thinking: say you’re using fibonacci(32) everywhere throughout your code, then one should define it with its direct final value (and perhaps add a comment to it, explaining that it’s fib32) instead of calculating it at every execution.

    So whilst this tool does some nice work, it shouldn’t be necessary if you’re coding in a “smart” way.