Bun v0.1.12 #1249
Jarred-Sumner
announced in
Announcements
Bun v0.1.12
#1249
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
To upgrade:
To install:
curl https://bun.sh/install | bash
If you have any problems upgrading
Run the install script (you can run it multiple times):
curl https://bun.sh/install | bash
bun install
gets faster & more reliablePreviously,
bun install
on Linux would crash or hang at least 1 out of every 80,000 cold package installs 🙈. It was particularly bad for download speeds < 100 mbps. Sometimes there were DNS hostname resolution issues as well (which caused a separate crash). If you were on a Linux kernel earlier than v5.5 or had a low memlock limit (e.g. using Ubuntu 18.04), it just wouldn't work at all.Bun v0.1.12 fixes that.
To end-to-end test this, I had a computer cold install 512 MB of
node_modules
for 2 hours in a loop (at least 800,000 cold package installs) and it installed successfully every time without crashing or hanging (unlike Bun v0.1.11 and earlier)The first run installed 100 times and the second 1,000 times.
Four different things caused stability issues:
getaddrinfo
Many of these issues applied to macOS as well (excluding the memlock limit one)
There are still important missing features in
bun install
, including support forgit
dependencies,github
dependencies,npm:
package aliasing, and workspaces support. Those are just not implemented yet, which is different than stability issues with existing features.fetch()
gets faster & more reliableThe eventing code for Bun's HTTP client has been rewritten to use uSockets and that, along with changes to concurrent task scheduling and HTTP keep-alive made sending HTTP requests in Bun faster & more reliable.
Bun's
fetch()
can send 155,000 requests per second on Linux x64:Code
The performance of
fetch
in Bun seems to be within 25% of optimized native HTTP benchmarking tools likeoha
andbombardier
(autocannon
, the more popular choice, only reaches 60k req/s)read.u8
inbun:ffi
read
inbun:ffi
lets you read pointers without creating a new DataView. This helps write faster libraries.Implementing this involved a change to WebKit's DOMJIT to enable 52-bit integer arguments (pointers)
This involved an unlikely but potentially breaking change to the pointer representation in
bun:ffi
. Previously,bun:ffi
pointers stored the memory address at the end of a JavaScript double (bit-casted a double to a 64-bit signed integer) and now the value is stored in the integer part of the double. This would only be a breaking change for libraries relying on the pointer representation in napiString.prototype.replace gets 2x faster
String.prototype.replace
gets 2x faster in Safari & Bun, thanks to @Constellation. It affects code like this:PRs:
This version of Bun updates to the latest WebKit as of September 17th, 2022 (which includes these PRs)
Faster
crypto.getRandomValues
andcrypto.randomUUID
crypto.getRandomValues
now uses BoringSSL's optimized random functionsNote: this screenshot was taken before bun's version was bumped to v0.1.12 which is why it shows v0.1.11 there
More
Buffer.from([123], "utf8")
Full Changelog: bun-v0.1.11...bun-v0.1.12
This discussion was created from the release Bun v0.1.12.
Beta Was this translation helpful? Give feedback.
All reactions