Skip to content

Commit

Permalink
Merge branch 'main' into jaco/coverage-include-exclude
Browse files Browse the repository at this point in the history
  • Loading branch information
AsafBenjaminov authored Jan 16, 2025
2 parents 9a4fa39 + 4cb8e37 commit 540f1ca
Show file tree
Hide file tree
Showing 718 changed files with 51,340 additions and 28,557 deletions.
26 changes: 26 additions & 0 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
name: Lint

on:
pull_request:
workflow_dispatch:

env:
BUN_VERSION: "1.1.38"
OXLINT_VERSION: "0.15.0"

jobs:
lint-js:
name: "Lint JavaScript"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Setup Bun
uses: ./.github/actions/setup-bun
with:
bun-version: ${{ env.BUN_VERSION }}
- name: Lint
run: bunx oxlint --config oxlint.json --quiet --format github




19 changes: 19 additions & 0 deletions .github/workflows/typos.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
name: Typos

on:
push:
branches:
- main
pull_request:
branches:
- main

jobs:
docs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Spellcheck
uses: crate-ci/[email protected]
with:
files: docs/**/*
2 changes: 1 addition & 1 deletion .lldbinit
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
command script import vendor/zig/tools/lldb_pretty_printers.py
# command script import vendor/zig/tools/lldb_pretty_printers.py
command script import vendor/WebKit/Tools/lldb/lldb_webkit.py

# type summary add --summary-string "${var} | inner=${var[0-30]}, source=${var[33-64]}, tag=${var[31-32]}" "unsigned long"
2 changes: 2 additions & 0 deletions .mailmap
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# To learn more about git's mailmap: https://ntietz.com/blog/git-mailmap-for-name-changes
chloe caruso <[email protected]> <[email protected]>
2 changes: 2 additions & 0 deletions .typos.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[type.md]
extend-ignore-words-re = ["^ba"]
16 changes: 8 additions & 8 deletions .vscode/launch.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

24 changes: 11 additions & 13 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Configuring a development environment for Bun can take 10-30 minutes depending on your internet connection and computer speed. You will need ~10GB of free disk space for the repository and build artifacts.

If you are using Windows, please refer to [this guide](/docs/project/building-windows.md)
If you are using Windows, please refer to [this guide](https://bun.sh/docs/project/building-windows)

## Install Dependencies

Expand Down Expand Up @@ -63,31 +63,29 @@ $ brew install llvm@18

```bash#Ubuntu/Debian
$ # LLVM has an automatic installation script that is compatible with all versions of Ubuntu
$ wget https://apt.llvm.org/llvm.sh -O - | sudo bash -s -- 16 all
$ wget https://apt.llvm.org/llvm.sh -O - | sudo bash -s -- 18 all
```

```bash#Arch
$ sudo pacman -S llvm clang lld
```

```bash#Fedora
$ sudo dnf install 'dnf-command(copr)'
$ sudo dnf copr enable -y @fedora-llvm-team/llvm17
$ sudo dnf install llvm16 clang16 lld16-devel
$ sudo dnf install llvm18 clang18 lld18-devel
```

```bash#openSUSE Tumbleweed
$ sudo zypper install clang16 lld16 llvm16
$ sudo zypper install clang18 lld18 llvm18
```

{% /codetabs %}

If none of the above solutions apply, you will have to install it [manually](https://github.com/llvm/llvm-project/releases/tag/llvmorg-16.0.6).
If none of the above solutions apply, you will have to install it [manually](https://github.com/llvm/llvm-project/releases/tag/llvmorg-18.1.8).

Make sure Clang/LLVM 18 is in your path:

```bash
$ which clang-16
$ which clang-18
```

If not, run this to manually add it:
Expand All @@ -96,13 +94,13 @@ If not, run this to manually add it:

```bash#macOS (Homebrew)
# use fish_add_path if you're using fish
# use path+="$(brew --prefix llvm@16)/bin" if you are using zsh
$ export PATH="$(brew --prefix llvm@16)/bin:$PATH"
# use path+="$(brew --prefix llvm@18)/bin" if you are using zsh
$ export PATH="$(brew --prefix llvm@18)/bin:$PATH"
```

```bash#Arch
# use fish_add_path if you're using fish
$ export PATH="$PATH:/usr/lib/llvm16/bin"
$ export PATH="$PATH:/usr/lib/llvm18/bin"
```

{% /codetabs %}
Expand Down Expand Up @@ -163,7 +161,7 @@ The binary will be located at `./build/release/bun` and `./build/release/bun-pro

### Download release build from pull requests

To save you time spent building a release build locally, we provide a way to run release builds from pull requests. This is useful for manully testing changes in a release build before they are merged.
To save you time spent building a release build locally, we provide a way to run release builds from pull requests. This is useful for manually testing changes in a release build before they are merged.

To run a release build from a pull request, you can use the `bun-pr` npm package:

Expand Down Expand Up @@ -240,7 +238,7 @@ The issue may manifest when initially running `bun setup` as Clang being unable
```
The C++ compiler
"/usr/bin/clang++-16"
"/usr/bin/clang++-18"
is not able to compile a simple test program.
```
Expand Down
2 changes: 1 addition & 1 deletion LATEST
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1.1.41
1.1.43
Binary file modified bench/bun.lockb
Binary file not shown.
2 changes: 1 addition & 1 deletion bench/hot-module-reloading/css-stress-test/src/index.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import ReactDOM from "react-dom";
import { Main } from "./main";

const Base = ({}) => {
const Base = () => {
const name = typeof location !== "undefined" ? decodeURIComponent(location.search.substring(1)) : null;
return <Main productName={name} />;
};
Expand Down
2 changes: 1 addition & 1 deletion bench/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
"execa": "^8.0.1",
"fast-glob": "3.3.1",
"fdir": "^6.1.0",
"mitata": "^1.0.10",
"mitata": "^1.0.25",
"react": "^18.3.1",
"react-dom": "^18.3.1",
"string-width": "7.1.0",
Expand Down
27 changes: 27 additions & 0 deletions bench/snippets/byteLength.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
import { Buffer } from "node:buffer";
import { bench, run } from "../runner.mjs";

const variations = [
["latin1", "hello world"],
["utf16", "hello emoji 🤔"],
];

for (const [label, string] of variations) {
const big = Buffer.alloc(1000000, string).toString();
const small = Buffer.from(string).toString();
const substring = big.slice(0, big.length - 2);

bench(`${substring.length}`, () => {
return Buffer.byteLength(substring, "utf8");
});

bench(`${small.length}`, () => {
return Buffer.byteLength(small);
});

bench(`${big.length}`, () => {
return Buffer.byteLength(big);
});
}

await run();
97 changes: 97 additions & 0 deletions bench/snippets/hash.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
import { bench, run } from "../runner.mjs";

// Can be strings or buffers.
const shortStr = Buffer.from("abcd1234"); // 8 chars
const longStr = Buffer.alloc(128 * 1024, "xABcDpQrStUvWxYz=-1]23]12312312][3123][123][");

// Short string benchmarks

bench("wyhash (short)", () => {
Bun.hash.wyhash(shortStr);
});

bench("adler32 (short)", () => {
Bun.hash.adler32(shortStr);
});

bench("crc32 (short)", () => {
Bun.hash.crc32(shortStr);
});

bench("cityHash32 (short)", () => {
Bun.hash.cityHash32(shortStr);
});

bench("cityHash64 (short)", () => {
Bun.hash.cityHash64(shortStr);
});

bench("xxHash32 (short)", () => {
Bun.hash.xxHash32(shortStr);
});

bench("xxHash64 (short)", () => {
Bun.hash.xxHash64(shortStr);
});

bench("xxHash3 (short)", () => {
Bun.hash.xxHash3(shortStr);
});

bench("murmur32v3 (short)", () => {
Bun.hash.murmur32v3(shortStr);
});

bench("murmur32v2 (short)", () => {
Bun.hash.murmur32v2(shortStr);
});

bench("murmur64v2 (short)", () => {
Bun.hash.murmur64v2(shortStr);
});

bench("wyhash (128 KB)", () => {
Bun.hash.wyhash(longStr);
});

bench("adler32 (128 KB)", () => {
Bun.hash.adler32(longStr);
});

bench("crc32 (128 KB)", () => {
Bun.hash.crc32(longStr);
});

bench("cityHash32 (128 KB)", () => {
Bun.hash.cityHash32(longStr);
});

bench("cityHash64 (128 KB)", () => {
Bun.hash.cityHash64(longStr);
});

bench("xxHash32 (128 KB)", () => {
Bun.hash.xxHash32(longStr);
});

bench("xxHash64 (128 KB)", () => {
Bun.hash.xxHash64(longStr);
});

bench("xxHash3 (128 KB)", () => {
Bun.hash.xxHash3(longStr);
});

bench("murmur32v3 (128 KB)", () => {
Bun.hash.murmur32v3(longStr);
});

bench("murmur32v2 (128 KB)", () => {
Bun.hash.murmur32v2(longStr);
});

bench("murmur64v2 (128 KB)", () => {
Bun.hash.murmur64v2(longStr);
});

run();
8 changes: 1 addition & 7 deletions bench/snippets/native-overhead.mjs
Original file line number Diff line number Diff line change
@@ -1,20 +1,14 @@
import { noOpForTesting as noop } from "bun:internal-for-testing";
import { bench, run } from "../runner.mjs";

// These are no-op C++ functions that are exported to JS.
const lazy = globalThis[Symbol.for("Bun.lazy")];
const noop = lazy("noop");
const fn = noop.function;
const regular = noop.functionRegular;
const callback = noop.callback;

bench("C++ callback into JS", () => {
callback(() => {});
});

bench("C++ fn regular", () => {
regular();
});

bench("C++ fn", () => {
fn();
});
Expand Down
Loading

0 comments on commit 540f1ca

Please sign in to comment.