Bun 0.8.1 version is released, fixing the problems of the previous version

Bun v0.8.1 release. This release comes a day after 0.8.0, and focuses on fixing several existing issues and bugs.

First of all, the new version solves a very critical problem: when dealing with malformed version names, bun installit will crash. This means that if the user enters "^0.0.2rc1"an invalid version identifier such as , the system stops functioning. In Bun v0.8.1, the developer team managed to fix this so that it bun installno longer crashes on this type of input. For the user, this undoubtedly increases the stability and reliability of the operation and improves the overall user experience.

In addition, another serious problem has also been fixed. Originally, the packager would automatically inline calls try/catchinside blocks that it knew would fail require()at runtime, which was useful when packaging code that used optional dependencies. However, this feature was enabled by mistake, resulting in possible runtime errors in some cases. Now this problem has been corrected, greatly improving the efficiency and stability of the code.

In addition, Bun v0.8.1 also fixes several other bugs, including node:httpa bug in proxy URLs, an issue bun installwith handling outdated package.jsonscripts, and bun --inspecta bug in source maps. These improvements all help improve Bun's overall performance and user experience.

In terms of introducing new features, the v0.8.1 version adds support for Unix domain sockets. This new feature allows you to point a socket to a file on the filesystem instead of a network host/port. This is useful when running servers that are only accessible from the same machine, such as in some container or proxy environments. In this way, the efficiency and security of data transmission can be effectively improved.

const server = Bun.serve({
  unix: "/tmp/my-socket.sock", // <-- new option
  fetch(req){
    console.log(req.url);
    return new Response("Hello world!");
  }
});

console.log(`Listening on unix:///tmp/my-socket.sock!`);

Performance optimization is another important content of this update. In v0.8.0, there is a performance degradation problem, the event loop scheduling is not working well enough, resulting in the failure to process the microtask queue in time when reading the request body. But in v0.8.1, this problem has been fixed. Test results show that the new version processes requests 2.8 times faster than v0.8.0, which will give users a noticeable speed boost.

Memory management is also where the Bun v0.8.1 version has been improved. Originally, Headersand Blobdid not report their size to the garbage collector, which could cause the garbage collector to not run as expected when Headersor was large enough. BlobBun now reports the size of Headersand to the garbage collector Blob, and each invocation fetch()reports the memory used to the garbage collector. This change will help to better manage memory resources and avoid affecting Bun's operating efficiency due to excessive memory usage.

Finally, it's worth mentioning that Bun 1.0 is scheduled for release on September 7th. This new major version will bring more functional improvements and updates, let us look forward to its arrival together!

Guess you like

Origin www.oschina.net/news/255433/bun-v0-8-1