MyGit

bun-v0.1.9

oven-sh/bun

版本发布时间: 2022-08-18 16:49:36

oven-sh/bun最新发布版本:bun-v1.1.20(2024-07-13 14:04:45)

To upgrade:

bun 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

What's new

JIT-optimized TextEncoder.encodeInto can be a 1.5x perf boost up to around a 5x perf boost

image

The hash() function in this microbenchmark calls ptr():

image

Internals

Bun learns how to JIT

DOMJIT is a JavaScriptCore API that gives 3rd-party embedders low-level access to the JIT compiler/assembler to optimize native functions and getters/setters. Safari leverages DOMJIT to make commonly-accessed properties like element.parentNode faster

Bun is beginning to use DOMJIT now, starting in two places:

To better support Bun's usecase, I extended DOMJIT to support Typed Array arguments, as well as added support for specifying more kinds of side effects that enable/disable optimizations:

Faster and more reliable JSC <> Zig bindings

At Bun's compile-time, Bun now code-generates C++ binding classes for JavaScript objects implemented in Zig. Previously, Bun mostly used the JavaScriptCore C API.

Using JavaScriptCore's C++ API improves performance and is important for making the garbage collector better aware of Bun's usage. But, writing bindings manually can be very repetitive.

Given a class definition in JavaScript like this:

define({
    name: "Response",
    construct: true,
    finalize: true,
    JSType: "0b11101110",
    klass: {
      json: {
        fn: "constructJSON",
      },
     // rest of the code
    },
    proto: {
      url: {
        getter: "getURL",
        cache: true,
      },

      text: { fn: "getText" },
      json: { fn: "getJSON" },
      arrayBuffer: { fn: "getArrayBuffer" },
      blob: { fn: "getBlob" },
      clone: { fn: "doClone", length: 1 },
     // rest of the code
    },
  })

Bun generates corresponding:

This approach is inspired by WebIDL bindings which both Safari and Chromium use.

More reliable event loop on Linux

This screenshot is with a simulated bandwidth limit and no throttling of max http connections

Previously, bun had a tendency to hang in situations like this

image

What's Changed

New Contributors

Full Changelog: https://github.com/oven-sh/bun/compare/bun-v0.1.8...bun-v0.1.9

相关地址:原始地址 下载(tar) 下载(zip)

1、 bun-darwin-aarch64-profile.zip 14.18MB

2、 bun-darwin-aarch64.zip 13.32MB

3、 bun-darwin-x64-baseline-profile.zip 16.58MB

4、 bun-darwin-x64-baseline.zip 15.71MB

5、 bun-darwin-x64-profile.zip 16.93MB

6、 bun-darwin-x64.zip 16.06MB

7、 bun-linux-aarch64-profile.zip 50.8MB

8、 bun-linux-aarch64.zip 29.59MB

9、 bun-linux-x64-baseline-profile.zip 51.49MB

10、 bun-linux-x64-baseline.zip 31.34MB

11、 bun-linux-x64-profile.zip 51.99MB

12、 bun-linux-x64.zip 31.71MB

查看:2022-08-18发行的版本