My name's Jared, and I'm going to talk about BUN. BUN is a modern all-in-one JavaScript runtime environment. It's designed to start fast, to achieve new levels of performance, to be a great and complete tool, and to be a drop-in replacement for Node.js.
BUN dev is a front-end dev server that starts in 4 milliseconds. It's a command that's built into BUN. BUN install is an NPM package manager, and it installs NPM packages 20 times faster than any other NPM client that exists today. BUN run is an NPM package JSON scripts runner, and it starts package JSON scripts 30 times faster than NPM.
In BUN v0.3.0, we added automatic NPM package installs to BUN's JavaScript runtime. That means you can just import packages and they install. There's no—you don't have to actually run an install step. This is automatically enabled when you—there is no node modules folder. So it still works with node modules, it just means when you don't have node modules, if you have a quick script that you just want to run and you don't want to have to deal with installing packages, it just works. The other thing that's really interesting about that is you can—you don't—because you don't need a node modules folder, you can just—it saves a lot of disk space and it saves you a lot of time because you don't have to spend this time installing the packages. It uses a shared global cache.
In BUN, JSX is natively supported. There's an automatic JSX slash TypeScript transpiler, JSX is even enabled for .JS files by the way, and you can also have npm packages which use JSX and BUN will just automatically transpile it. You can console.log JSX, you can do JSX prop punting and we have an extremely optimized React server-side render.
This is what it looks like when you console.log a JSX element in BUN. You can see that instead of printing the object representation with the symbols and all that stuff, it actually just pretty prints it like HTML a little bit. You can see it still preserves this is a function, or it highlights the component to be blue instead of green to indicate that it's an element versus a component. And then this is what JSX prop hunting looks like in BOTnets. There's more than one name for this, but the basic idea is that instead of having to type if the property name is the same identifier as the value, you can just emit the value. So that way, it's the equivalent of object destructuring syntax, but for JSX. I don't think there are other tools that support this yet. In the next version of React, they're adding a new bun streaming server render, and that helps make bun three and a half times faster at server-side rendering compared to when using the server.browser build, which is the one that bun currently uses. Overall, this adds up to four times faster server-side rendering in bun compared to node.
This benchmark here is a Hello World benchmark for a very simple React app. If you've used any framework in the past, for building front-end stuff with React, you've probably used hot module reloading. Usually hot module reloading is something that exists on the client, it's run in browsers. But in bun, bun has built-in support for hot module reloading on the server.
Comments