Evolution of JS and Tools
We started building large projects and felt the need to solve our bundling issues. And we welcomed Webpack in 2012. Now one less thing to worry about.
We started talking about polyfills. We knew indexOf works across the browsers but includes doesn’t. Writing polyfills in interviews became a trend. And then we welcomed babel in 2014. Fast forward to 2022, polyfill is obsolete. I already feel old because of this!
Not everything is about JS! We want to be fast!
Right when we were beginning to feel like JS God(sometimes being lame is cool!), tools like webpack and babel started to feel the heat! There were competitors.
Welcome Bun!BUN Logo
JS is fast. No pun intended!! Hmm..maybe or maybe not. Depends. But we do love it when something new is introduced in our ‘small’ JS world.
‘Bun intended!!’We want fast…more fast…blazing fast!!!
We want fast…more fast…blazing fast!!!
Year 2022, Jarred Summer just announced its beta release and claims that it’s significantly faster than node.
Faster? How much? Orders of magnitude faster!! Post covid scenes are definitely going to be significantly different. :)BUN claims exceptional performance
Bun claims exceptional performance
It’s always a good idea to be a little sceptical about the benchmarks provided by the creator, but as we can see above, it’s almost 3 times faster when server rendering React, running database queries or running native code. Definitely impressive!!Source
What makes it fast?SOURCE
Bun doesn’t use the V8 engineSource: WEBKIT
As the creators of Bun says:
An enormous amount of time spent profiling, benchmarking and optimising things. The answer is different for every part of Bun, but one general theme: Zig’s low-level control over memory and lack of hidden control flow makes it much simpler to write fast software.
What does it offer?Source
It’s fun to go fast! But more importantly Bun is an all-in-one runtime.
Native Bundler: It has a native bundler to replace tools like WebPack and also has a native transpiler so you can write TypeScript code out of the box with cool features like top level await.
Transpile: Bun will also transpile JSX files. Also, like Dino, it prioritises web api’s like fetch and also supports many node core modules as well as node apis which will allow many node packages to also run in Bun.
Node Packages: It implements node’s module resolution algorithm, which means, you can install packages from npm into Bun and those packages install 20 times faster. Magic!!
‘All in one fast & easy-to-use tool. Instead of 1,000 node_modules for development, you only need a bun.’
Environment Variables: Another feature is that environment variables load automatically. So, .env need not be installed into every project.
Test Runner: It also comes with its own test runner similar to Jest. And again it’s fast. Blazingly fast!
It’s still experimental! It’s beta. And we can expect bugs. Even if this tool is not yet production-ready it is awesome that such new tools and the metrics are coming up. Oh man, causes an adrenaline rush!
Also, Bun is not an all around tool. Do check out https://github.com/Jarred-Sumner/bun and you can find a link to check the things that don’t work yet.
What’s next? Let’s get our hands dirty and feel the power.