Bun 1.0 Ships as Node.js and Deno Alternative
“The thing I wish we had more time for is making Bun good for frontend development,” Sumner said during an X (Twitter) Q&A after the Thursday launch. “It’s not bad for it — you can use […] the tools you already use. But I still think there’s a big opportunity there for something where the runtime is directly integrated with the frontend build tools.”
That said, no one responding about Bun seemed to care after its release. Feedback from users made it clear that it was fine to remove the frontend server, he noted, and the majority of the responses to this news on social media was positive. By Friday, the buzz over Bun was all about its speed and ease of use.
Built for Speed
Bun competes with Node.js and the Rust-based Deno, which were both created by Ryan Dahl. In fact, it’s designed to be a drop-in replacement for Node.js, according to a release livestream that aired Thursday. Bun writes three times faster than Node.js and reads files up to three times faster, the team said during the livestream. Ashcon Partovi, product manager at Oven, the company that created Bun, addressed Bun runtime.
“There are a lot of tools in the Bun toolkit,” Partovi said. “But the crown jewel is the Bun runtime. Bun is a drop in replacement for Node.js that’s backward compatible, and can run Typescript and TSX files, no dependencies necessary.”
He added that Bun can replace any npm run command with a Bun run instead, with npm taking about 150 milliseconds to start running a script on a MacBook Pro. That’s compared to 30 milliseconds for Bun, he said.
“Npm feels noticeably laggy. Whereas Bun feels instantaneous,” Partovi said.
“Node.js, Bun and Deno are all server-side js runtimes, but they have completely different goals.
“Powered by Zig, its aim is to be an all-in-one runtime and toolkit with a focus on speed, bundling, testing and compatibility with Node.js packages,” he wrote.”One of its biggest draws is its performance, which is demonstrably faster than both Node.js and Deno. This makes it a very attractive proposition if it can deliver on all of that.”
He noted that the Bun maintainers provided an example benchmark running an HTTP handler that renders a server-side page with React. Bun handled about 68,000 requests per second compared to about 29,000 and 14,000 for Deno and Node.js, respectively.
In his own tests of an earlier version of Bun, Konik found Node.js handled 21.29 average queries per second, while Deno rated 43.50. Bun handled 81.37 average queries per second.
“In another comparison between Node.js, Deno and Bun, Bun is the fastest to handle concurrent connections. Its requests per second are quite higher too,” Konik wrote. “For instance, with 10 concurrent connections, Bun achieves 110,000 requests per second while Node.js achieves 60,000 and 67,000 for Deno.”
It’s worth noting that a different comparison found Deno and Bun performed very similarly.
“Bun is more concerned with performance, so it is much better than the other two runtimes in terms of performance right now,” he wrote. “Deno is synonymous with safety, in my opinion, I can safely use packages from the community without worrying about them doing things to my system that I don’t know about. Node is now starting to make a big push on performance and security, too.
“Competition is good, js runtime is starting to evolve,” he added.
More to Come from Bun
That said, Bun is still a work in progress. For instance, Bun Install is ready for Linux and Mac OS but the team was struggling to get the Windows version working, Sumner revealed during an X (Twitter) Q&A held after Thursday’s release. Bun provides a limited, experimental native build for Windows. At the moment, only the Bun runtime is supported, according to the documentation.
“Bun Install will probably be two weeks later is my guess,” Sumner said. “And this is going to be super unoptimized in the first release for Windows. It’s going to take some time before it actually is fast. “
In addition to the runtime, Bun has baked in features that will make developers’ lives easier, said Sumner, such as:
- Support for both common JS and ES modules
- Support for hate reading using –hot server.ts
- A plug-in API that lets developers define custom loaders
“You can extend the Bun runtime to support things like .Yaml imports,” he said. “It uses an API that is inspired from ES build, which means many ES build plugins just work in Bun.”