Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
225 commits
Select commit Hold shift + click to select a range
564c4ff
Remove the zstd C library from the build
claude Oct 27, 2026
8c197b5
zstd: add the decoder in safe Rust
claude Oct 27, 2026
93bb106
zstd: add the compressor in safe Rust (work in progress)
claude Oct 27, 2026
360684e
zstd: remove what nothing uses, and what clippy finds
claude Oct 27, 2026
09ce132
zstd: the match finders and the entropy coders as verified against C
claude Oct 27, 2026
43aa6d8
Bun.zstdCompress: a failed allocation is an out of memory error
claude Oct 27, 2026
0f99288
zstd: optimize the crate in debug builds
claude Oct 27, 2026
519fe26
zstd: test that the output is that of the C library
claude Oct 27, 2026
caaa573
Merge remote-tracking branch 'origin/main' into claude/zstd-rust-repl…
claude Oct 27, 2026
41d3dad
zstd: remove the scratch files, and keep one copy of a dictionary
claude Oct 27, 2026
45523f4
zstd: zero output once, feed workers all of a write, drop what nothin…
claude Oct 27, 2026
de3e36b
zstd: the harness that compares the port with the C library
claude Oct 27, 2026
42b3576
zstd: take the harness out again
claude Oct 27, 2026
f020d88
zstd: decode sequences as fast as the C library
claude Oct 27, 2026
a20882e
zstd: faster match finders and sequence encoder, and what mordant found
claude Oct 27, 2026
11a8d5b
zstd: shorter prologues in the generic match finders, contexts are Sync
claude Oct 27, 2026
9c7f6e0
zstd: a job with workers makes room for the long distance matches of …
claude Oct 27, 2026
078890f
zstd: price the offset of a match once, not for each of its lengths
claude Oct 27, 2026
b37c7d4
zstd: a worker does not clear its tables for a job larger than those …
claude Oct 27, 2026
20bd848
zstd: find where a match ends 16 bytes at a time, and where it starts…
claude Oct 27, 2026
7bbf2a0
zstd: fast reads the input once per turn and indexes both positions o…
claude Oct 27, 2026
9ca1713
zstd: fast keeps what it needs once per match out of the way of the s…
claude Oct 27, 2026
2fd7bd8
zstd: the codes of a sequence come with its extra bits and are counte…
claude Oct 27, 2026
d43d2f4
zstd: dfast keeps what it needs once per match out of the way of the …
claude Oct 27, 2026
a9409b1
zstd: the tables of the predefined distributions are not made again f…
claude Oct 27, 2026
7d42e1b
zstd: 8 equal bytes before a match take no detour if no more can be t…
claude Oct 27, 2026
c67b15a
zstd: a new context makes and clears less, and tables that cannot be …
claude Oct 27, 2026
6c8cf31
zstd: the buffers of a compression stream are not cleared
claude Oct 27, 2026
84d8c68
zstd: one way to reset a table, whatever it is a table of
claude Oct 27, 2026
9204768
zstd: say that it is a port, where it was said to be a C library
claude Oct 27, 2026
7259097
zstd: workers touch no more memory than they use
claude Oct 27, 2026
23e4312
node:zlib: take the ZSTD_* constants from the crate
claude Oct 27, 2026
553042b
zstd: test frames that no encoder makes, damaged frames, and abandone…
claude Oct 27, 2026
8038637
zstd: fast with two segments goes about it as with one
claude Oct 27, 2026
671862e
[autofix.ci] apply automated fixes
autofix-ci[bot] Oct 27, 2026
4a978bc
zstd: dfast with two segments reads the input once per position
claude Oct 27, 2026
a393a00
zstd: fast with a dictionary's match state reads the input once per p…
claude Oct 27, 2026
f3eb4d3
zstd: dfast with a dictionary's match state reads the input once per …
claude Oct 27, 2026
9104943
zstd: workers share one queue of jobs
claude Oct 27, 2026
a5239f0
zstd: a context keeps no books of the workspace that the C code would…
claude Oct 27, 2026
df51c0f
zstd: a Huffman table is made from the symbols that occur, and its tr…
claude Oct 27, 2026
74929d0
zstd: less between the end of a match and the next look at the table,…
claude Oct 27, 2026
7a59b4e
zstd: less between the end of a match and the next look at the tables…
claude Oct 27, 2026
129ede9
zstd: how many bits a sequence takes is read from the bits themselves
claude Oct 27, 2026
ef448e6
zstd: fast copies up to 32 literals without looking at their number
claude Oct 27, 2026
226e9d6
zstd: speed up the binary tree match finders and the optimal parser
claude Oct 27, 2026
aae1516
zstd: a table that gets shorter and longer again is not cleared as lo…
claude Oct 27, 2026
75f0c60
zstd: the buffer of literals is cleared only as far as blocks are long
claude Oct 27, 2026
08619eb
zstd: fast and dfast know the sizes of the tables of the default para…
claude Oct 27, 2026
7bf8f5b
zstd: dfast only asks whether an index was too low once the bytes are…
claude Oct 27, 2026
f5e9ea1
zstd: likewise with two segments and with a dictionary's match state
claude Oct 27, 2026
ef0f733
zstd: room for sequences and literals is made for the blocks that com…
claude Oct 27, 2026
5a0d69b
zstd: the table sizes of levels 1 and 3 for small inputs are known as…
claude Oct 27, 2026
0890796
zstd: faster greedy, lazy and lazy2
claude Oct 27, 2026
9f39636
zstd: fast only asks whether an index was too low once the bytes are …
claude Oct 27, 2026
045f575
zstd: nor does dfast for the long match after a short one
claude Oct 27, 2026
fe2ce75
zstd: cheaper searches in the tree of a dictionary, and long runs of …
claude Oct 27, 2026
7d8106d
Merge branch 'claude/zstd-rust-replacement-4qwmbq' into perf/tree
claude Oct 27, 2026
9e7dc50
Merge branch 'claude/zstd-rust-replacement-4qwmbq' into perf/entropy
claude Oct 27, 2026
b834806
zstd: Table::reset tells whether the memory is new
claude Oct 27, 2026
173f5c1
Merge branch 'claude/zstd-rust-replacement-4qwmbq' into perf/entropy
claude Oct 27, 2026
16f007a
zstd: sequences are decoded by the batch, then executed
claude Oct 27, 2026
3d05cac
zstd: a Huffman lookup yields up to 3 literals, and streams that end …
claude Oct 27, 2026
68e6f8e
zstd: a streaming decoder touches no more of its buffers than it uses
claude Oct 27, 2026
6196cf2
zstd: a skippable frame that goes on past the input has an extent too
claude Oct 27, 2026
da99d07
zstd: far matches are prefetched while a batch of sequences is decoded
claude Oct 27, 2026
edc24da
zstd: the decoder adapts to long matches, close matches, lengths with…
claude Oct 27, 2026
1bcb9f7
zstd: four Huffman streams are decoded at a time until the last one i…
claude Oct 27, 2026
a8e5dae
zstd: the ends of streams are decoded from padded copies, and tables …
claude Oct 27, 2026
0b8022c
zstd: matches in a dictionary are of the common kind, and a thread's …
claude Oct 27, 2026
f4b98cd
zstd: the weights of a Huffman table, a lone stream of literals and t…
claude Oct 27, 2026
bf490c6
zstd: a frame header is read into place, and the counts of a table wi…
claude Oct 27, 2026
e62cc5c
zstd: no shift by more than there are bits where a lookup is longer t…
claude Oct 27, 2026
4bd2cf7
zstd: the loops of the decoder that come in several kinds are inlined…
claude Oct 27, 2026
eb486de
zstd: matches in what a streaming decoder's buffer holds from before …
claude Oct 27, 2026
5f7d028
zstd: the tables of a few sequences are used where they are
claude Oct 27, 2026
964de3e
zstd: what the tables of sequences tell about them is theirs to tell
claude Oct 27, 2026
675a92a
zstd: the size of a decoder counts all that it allocates to decode bl…
claude Oct 27, 2026
63cfe2c
zstd: merge the main line; what fast and dfast look their tables up w…
claude Oct 27, 2026
d99e43e
zstd: btlazy2 sets up its searches once per block
claude Oct 27, 2026
2a7f4b4
Merge the faster fast and dfast match finders
claude Oct 27, 2026
bbfa74a
Merge branch 'claude/zstd-rust-replacement-4qwmbq' into perf/entropy
claude Oct 27, 2026
742599d
Merge the faster binary tree match finders and optimal parser
claude Oct 27, 2026
09f9383
zstd: the next sequence waits less for the states that it is decoded …
claude Oct 27, 2026
5c967a6
zstd: a name for additional bits that is not that of another parameter
claude Oct 27, 2026
ff8bd0e
zstd: a hash rate above the window does not make for a table of 8 GiB
claude Oct 27, 2026
34ccfab
zstd: a small output is decoded where there is room to copy in chunks…
claude Oct 27, 2026
510435d
zstd: the loop over four Huffman streams knows how many bits it looks up
claude Oct 27, 2026
a91dd57
zstd: the older segment on its own goes by that name
claude Oct 27, 2026
dbf8fea
zstd: a block of a few literals is left as it is without making table…
claude Oct 27, 2026
3b1ddb3
Merge branch 'claude/zstd-rust-replacement-4qwmbq' into perf/entropy
claude Oct 27, 2026
460ed0b
zstd: zeros follow the literals of a block, and a thread's next decod…
claude Oct 27, 2026
8ff6f3f
DecompressionStream: empty chunks in the middle of a zstd frame are n…
claude Oct 27, 2026
3fe9b40
zstd: with workers, input that is not of the pledged size is an error
claude Oct 27, 2026
745d76f
zstd: a streaming decoder starts each frame with empty buffers, and c…
claude Oct 27, 2026
55d4fad
zstd: merge the main line
claude Oct 27, 2026
7d3ca60
zstd: a small output is decoded elsewhere only if nothing before it i…
claude Oct 27, 2026
27cd088
zstd: a compressed block that makes more than the largest block is an…
claude Oct 27, 2026
deafcc0
zstd: a long match does not end a run of common sequences
claude Oct 27, 2026
362ddb1
Merge branch 'claude/zstd-rust-replacement-4qwmbq' into perf/entropy
claude Oct 27, 2026
8041458
zstd: a streaming decoder refuses offsets beyond the window once its …
claude Oct 27, 2026
ddf9cc3
zstd: fewer copies and fewer batches for a small block
claude Oct 27, 2026
212f9ba
zstd: merge the main line
claude Oct 27, 2026
7461d8a
Merge the faster entropy stage and context setup
claude Oct 27, 2026
9e0d395
zstd: workers reset their tables and make their contexts like anyone …
claude Oct 27, 2026
bc18f77
zstd: with matches far back, what few sequences a block has are known…
claude Oct 27, 2026
b5f24e0
zstd: without rare symbols, the states of a table find their symbols …
claude Oct 27, 2026
916f38a
node:zlib: a zstd dictionary that cannot be loaded is an error
claude Oct 27, 2026
b8025bf
zstd: the total of the Huffman weights comes from how many there are …
claude Oct 27, 2026
dcbcaf1
zstd: long matches far back are still copied while the next sequences…
claude Oct 27, 2026
977ef37
zstd: fast and dfast have one version for all parameters but the defa…
claude Oct 27, 2026
2fa2eb4
zstd: dfast only asks ahead for what is in large tables
claude Oct 27, 2026
2f442d1
zstd: test for the bugs that zstd has had
claude Oct 27, 2026
bee54ea
zstd: fast checks once for what it reads around the end of a match, a…
claude Oct 27, 2026
8e241a5
zstd: so does dfast
claude Oct 27, 2026
eb2aea2
zstd: with a dictionary's match state, how many bytes are hashed is k…
claude Oct 27, 2026
fd951f4
zstd: nobody waits for workers to leave
claude Oct 27, 2026
e4de7df
zstd: test for the code of an error
claude Oct 27, 2026
6625957
Merge the second round on the decoder
claude Oct 27, 2026
8e12289
zstd: fast with a dictionary's match state checks once around the end…
claude Oct 27, 2026
3c5a477
zstd: and with two segments
claude Oct 27, 2026
06433fd
zstd: a thread's next decoder takes over no output either
claude Oct 27, 2026
0ffd40a
zstd: fast and dfast index a dictionary by 10 bytes at a time, and wi…
claude Oct 27, 2026
2717485
zstd: nothing to index is no error
claude Oct 27, 2026
3c893fc
zstd: the lazy parsers weigh a repeat offset only where it gives a match
claude Oct 27, 2026
573e4c0
zstd: fetch all of a row of 64 ahead of its search
claude Oct 27, 2026
0db59a6
zstd: faster hash chains, most of all for short inputs
claude Oct 27, 2026
c2216a5
zstd: a match right after another one is not looked at for what is be…
claude Oct 27, 2026
0e01a37
zstd: say what the versions of fast and dfast are for
claude Oct 27, 2026
3d4a5e7
zstd: test for more of the bugs that zstd has had
claude Oct 27, 2026
034f39d
zlib: the sizes of zstd contexts as they are now
claude Oct 27, 2026
e8013cc
zstd: merge the main line
claude Oct 27, 2026
8f7a87e
verify-baseline: pass a per-test timeout to the emulated bun test run
claude Oct 27, 2026
31103d4
Merge the second round on the fast and double fast match finders
claude Oct 27, 2026
813eb78
zstd: workers that could not be started are started for the next frame
claude Oct 27, 2026
ec24e1d
zstd: indices start again where the C code replaces its workspace, an…
claude Oct 27, 2026
6579103
zstd: a unit test for the size of the table of long distance matches
claude Oct 27, 2026
7e0e64b
zstd: streams in tests report their errors
claude Oct 27, 2026
0c8383f
zstd: fast and dfast with an attached dictionary branch on the tag al…
claude Oct 27, 2026
7dc6d29
zstd: streams in tests report that they were closed, too
claude Oct 27, 2026
a9fef23
zstd: an output that is allocated for its frames has room to copy in …
claude Oct 27, 2026
aaa1236
zstd: a branch on additional bits is worth it up to one length in seven
claude Oct 27, 2026
15a9f11
zstd: the copy of the start of a stream is made where it stays
claude Oct 27, 2026
fad8f8f
zstd: a tiny output is allocated without room after it
claude Oct 27, 2026
b721dc5
Merge branch 'main' into claude/zstd-rust-replacement-4qwmbq
claude Oct 28, 2026
dc8cf4b
node:zlib: zstd no longer hands back C strings of its own
claude Oct 28, 2026
ea26005
Tests no longer name zstd as a C dependency
claude Oct 28, 2026
55c98c0
zstd: a growing output is zeroed at most 64 steps ahead
claude Oct 28, 2026
708e9b4
zstd tests: level -2 instead of -1, which node:zlib takes for unset
claude Oct 28, 2026
61bc26a
zstd: btlazy2 searches a short segment in the loop of the parser, wit…
claude Oct 27, 2026
c1cb938
zstd: btlazy2 compares candidates by their first 16 bytes, without wa…
claude Oct 27, 2026
9863320
zstd: the comparison of 16 bytes is done on vectors with overflow che…
claude Oct 27, 2026
8990d63
zstd: btlazy2 does not go down a tree that has nothing
claude Oct 27, 2026
65d2eea
zstd: the errors are in error.rs, as Error and Result
claude Oct 28, 2026
0b92c0c
zstd: workers give up a frame within a block or 4096 positions of a p…
claude Oct 28, 2026
60b35fe
zstd: tests for four fixes to the optimal parser that nothing noticed…
claude Oct 28, 2026
0a40fdc
zstd: rows of 64 entries stay a comparison of vectors in a release build
claude Oct 28, 2026
8e0cb85
zstd: remove two parameters that follow from a third
claude Oct 28, 2026
901a9d9
zstd: split three tests that took over 3 s each in a debug build
claude Oct 28, 2026
1c78c76
zstd: fast and dfast ask whether there is a repeat offset only once i…
claude Oct 28, 2026
1df8f8c
zstd: the length of a match is a comparison of vectors, the first one…
claude Oct 28, 2026
7245ee8
zstd: the lookups between two reloads of four Huffman streams are wri…
claude Oct 28, 2026
e5c4c3c
zstd: few literals of long codes are decoded one to a lookup
claude Oct 28, 2026
efbf33d
zstd: the room for a frame is zeroed block by block
claude Oct 28, 2026
7f195c7
zstd: the counts of a table are read with less to wait for
claude Oct 28, 2026
eacaef1
zstd: long copies are split where glibc's are slow
claude Oct 28, 2026
6b2def7
zstd: what one call decodes is not zeroed before it is written
claude Oct 28, 2026
5a031e0
ci: skip the bun_sema spelling test under Miri
claude Oct 28, 2026
e4d6720
zstd: decode long Huffman codes one symbol to a lookup
claude Oct 28, 2026
a77f135
zstd: a buffer whose content is of no use is not copied when it grows
claude Oct 28, 2026
a87cc41
zstd: less for the optimal parser to do where there is no match
claude Oct 28, 2026
11efee8
zstd: btlazy2 hands shorter runs of positions to the tight insertion …
claude Oct 28, 2026
7ddcdb5
zstd: the block splitter reports an allocation that fails
claude Oct 28, 2026
0cfb03b
zstd: a block asks for room once its sequences are known
claude Oct 28, 2026
40b288f
zstd: a unit test does not depend on where its buffers are
claude Oct 28, 2026
4a881e2
zstd: long matches are counted 64 bytes at a time
claude Oct 28, 2026
29f26b7
zstd: the optimal parsers go over what has no match in one loop
claude Oct 28, 2026
72f95e5
zstd: long copies to the end of a large new buffer are made in parts
claude Oct 28, 2026
d574f50
zstd: short matches from less than 16 bytes back have a loop of their…
claude Oct 28, 2026
f629239
zstd: a stream that has failed stays failed, and is not mixed with wh…
claude Oct 28, 2026
a88148b
zstd: what starts a new job resets a stream, and a compressor that ha…
claude Oct 29, 2026
d106dc8
zstd: what `exec_batch` does before its loop is a function of its own
claude Oct 29, 2026
e48dc2d
zstd: matches in a dictionary are of the common kind wherever the out…
claude Oct 29, 2026
39b1e9f
zstd: sequences are executed in batches also while literals would be …
claude Oct 29, 2026
3403829
Merge branch 'main' into claude/zstd-rust-replacement-4qwmbq
claude Oct 29, 2026
68fca8c
build: the C decoder of zstd stays for the `jsc` shell that reads a p…
claude Oct 29, 2026
f677884
Merge remote-tracking branch 'origin/main' into claude/zstd-rust-repl…
claude Oct 29, 2026
c788848
zstd: lazy and lazy2 share their code
claude Oct 29, 2026
9b6d330
zstd: fast and dfast are compiled for the sizes of tables only
claude Oct 29, 2026
33a1c7b
zstd: literals that are stored or one byte are not written to a buffe…
claude Oct 29, 2026
a7fb6eb
zstd: a round trip that fails is not taken for a parameter that is ac…
claude Oct 29, 2026
51386a6
build: --local-deps=zstd is taken again where zstd is built
claude Oct 29, 2026
dd89d78
zstd: the contexts of workers are in a pool, as in the C code
claude Oct 30, 2026
79995be
test: one shape of build-scaling grows 2.58 times in memory
claude Oct 30, 2026
41fad94
zstd: records that differ in a field no longer have every candidate c…
claude Oct 30, 2026
605aa6e
zstd: a single Huffman stream of short codes is no longer left to the…
claude Oct 30, 2026
07e8c4e
zstd: the second tags of the rows are given up within a block where t…
claude Oct 30, 2026
9778f06
zstd: btlazy2 gives no hints in the first block and adds skipped posi…
claude Oct 30, 2026
b06f15d
zstd: the buffer of the literals is cleared as they come, not all at …
claude Oct 30, 2026
dd2ac32
zstd: which of two positions is the smaller one is told from 16 bytes…
claude Oct 31, 2026
8f8c6f4
zstd: the optimal parser gives fewer hints while it adds the position…
claude Oct 31, 2026
d38578f
Merge remote-tracking branch 'origin/main' into claude/zstd-rust-repl…
claude Oct 31, 2026
d0d121d
zstd: a match in the older segment of the window that ends within 16 …
claude Oct 31, 2026
615100a
zstd: a unit test for where the current segment of the window starts
claude Oct 31, 2026
8aec2cd
zstd: rows with a dictionary that is searched in place: a tighter loo…
claude Oct 31, 2026
43bf90a
Merge remote-tracking branch 'origin/main' into claude/zstd-rust-repl…
claude Oct 31, 2026
f8cc91e
Merge remote-tracking branch 'origin/main' into claude/zstd-rust-repl…
claude Oct 31, 2026
8d25bbb
The zstd side of the ICU hook is compiled for FreeBSD too
claude Oct 31, 2026
21acd17
zstd: the contexts that are kept are not in place
claude Oct 31, 2026
306afc8
zstd: the optimal parser passes what has no match faster with a dicti…
claude Oct 31, 2026
eb1ad32
Merge remote-tracking branch 'origin/main' into claude/zstd-rust-repl…
claude Nov 1, 2026
285d751
test: whether zstd's sources are fetched does not depend on the cache…
claude Nov 1, 2026
666b766
zstd: the optimal parser's loop for what has no match goes on while a…
claude Nov 1, 2026
3e02569
zstd: an enum for where the repeat offsets lead, in place of a second…
claude Nov 1, 2026
3efec57
verify-baseline: the timeout of main for the emulated run
claude Nov 1, 2026
55c9643
zstd: the same loop while a repeat offset leads into an older segment…
claude Nov 1, 2026
de7ed9c
zstd: positions that are added to the binary trees are compared 8 byt…
claude Nov 1, 2026
f9f4dec
zstd: a copy of get_all_matches for a dictionary in place and one for…
claude Nov 1, 2026
04d5d27
Merge remote-tracking branch 'origin/main' into claude/zstd-rust-repl…
claude Nov 1, 2026
209068d
zstd: a position that is added to the binary trees does not wait for …
claude Nov 1, 2026
fc13be2
zstd: sequences that are taken one at a time are decoded in registers…
claude Nov 1, 2026
1e78952
zstd: a worker stops while it indexes its prefix in rows, and a dicti…
claude Nov 2, 2026
98c81e3
test: compile-trim-capabilities scans only the Mach-O sections that h…
claude Nov 2, 2026
46048ba
Merge remote-tracking branch 'origin/main' into claude/zstd-rust-repl…
claude Nov 7, 2026
2510945
Merge remote-tracking branch 'origin/main' into claude/zstd-rust-repl…
claude Nov 11, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
106 changes: 0 additions & 106 deletions .github/workflows/update-zstd.yml

This file was deleted.

1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,6 @@ codegen-for-zig-team.tar.gz
/src/deps/WebKit
/src/deps/zig
/src/deps/zlib
/src/deps/zstd

# Generated files

Expand Down
2 changes: 1 addition & 1 deletion CLAUDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ The Rust side is a Cargo workspace of ~200 crates rooted at `Cargo.toml`. The ke

#### Vendored Dependencies (`vendor/`)

Third-party native libraries are vendored locally and can be read from disk (not git submodules): boringssl (TLS/crypto), brotli, cares (async DNS), highway (SIMD), libdeflate, libuv (Windows event loop), lolhtml (HTML rewriter), lshpack (HTTP/2 HPACK), lsqpack + lsquic (HTTP/3), mimalloc (allocator), nodejs (headers), picohttpparser, rust-argon2 (argon2 for `Bun.password`, Rust), tinycc (FFI JIT, fork: oven-sh/tinycc), WebKit (JavaScriptCore), zlib (zlib-ng), zstd. Build configuration for these is in `scripts/build/deps/*.ts`.
Third-party native libraries are vendored locally and can be read from disk (not git submodules): boringssl (TLS/crypto), brotli, cares (async DNS), highway (SIMD), libdeflate, libuv (Windows event loop), lolhtml (HTML rewriter), lshpack (HTTP/2 HPACK), lsqpack + lsquic (HTTP/3), mimalloc (allocator), nodejs (headers), picohttpparser, rust-argon2 (argon2 for `Bun.password`, Rust), tinycc (FFI JIT, fork: oven-sh/tinycc), WebKit (JavaScriptCore), zlib (zlib-ng). Build configuration for these is in `scripts/build/deps/*.ts`.

### JavaScript Class Implementation (C++)

Expand Down
27 changes: 2 additions & 25 deletions Cargo.lock

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

5 changes: 5 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"src/bundler",
"src/collections",
"src/css",
"src/errno",

Check warning on line 11 in Cargo.toml

View workflow job for this annotation

GitHub Actions / lol-html cargo test

explicit `package.readme` can be inferred
"src/glob",
"src/http",
"src/install",
Expand Down Expand Up @@ -514,6 +514,11 @@
bun_which = { path = "src/which" }
bun_transpiler = { path = "src/transpiler" }

# At opt-level 0 a codec is slow enough for tests to time out. The C library that this replaces was optimized in debug
# builds too.
[profile.dev.package.bun_zstd]
opt-level = 3

# Loops over every byte of an image: unoptimized, a debug build takes seconds per megapixel. Assertions and overflow
# checks stay on. scripts/build/flags.ts does the same for highway_png.cpp.
[profile.dev.package.bun_png]
Expand Down
2 changes: 1 addition & 1 deletion LICENSE.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ Bun statically links these libraries:
| [`lsquic`](https://github.com/litespeedtech/lsquic) | MIT (portions derived from [Chromium proto-quic](https://github.com/litespeedtech/lsquic/blob/master/LICENSE.chrome), BSD 3-Clause) |
| [`mimalloc`](https://github.com/microsoft/mimalloc) | MIT |
| [`picohttp`](https://github.com/h2o/picohttpparser) | dual-licensed under the Perl License or the MIT License |
| [`zstd`](https://github.com/facebook/zstd) | dual-licensed under the BSD License or GPLv2 license |
| [`zstd`](https://github.com/facebook/zstd) (not linked: `src/zstd` is a port of it) | dual-licensed under the BSD License or GPLv2 license |
| [`simdutf`](https://github.com/simdutf/simdutf) | Apache 2.0 |
| [`tinycc`](https://github.com/tinycc/tinycc) | LGPL v2.1 |
| [`uSockets`](https://github.com/uNetworking/uSockets) | Apache 2.0 |
Expand Down
37 changes: 0 additions & 37 deletions patches/zstd/bmi2-probe-once.patch

This file was deleted.

28 changes: 0 additions & 28 deletions patches/zstd/free-workers-before-dictionaries.patch

This file was deleted.

14 changes: 7 additions & 7 deletions scripts/build/CLAUDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ This directory generates `build.ninja`. The scripts **describe** the build; ninj

**Deps in our graph.** `BuildSpec` variants:

- `direct` — list the dep's sources explicitly; each becomes a first-class `cc`/`cxx` edge in our graph and the `.o`s go straight into bun's link. Every C/C++ dep that is compiled (zlib, zstd, boringssl, mimalloc, … and a local WebKit checkout). Skips a sub-process configure entirely and lets LTO see across the dep boundary. `groups` are further flag sets (a cmake "target" each), `steps` are generators and target executables.
- `direct` — list the dep's sources explicitly; each becomes a first-class `cc`/`cxx` edge in our graph and the `.o`s go straight into bun's link. Every C/C++ dep that is compiled (zlib, boringssl, mimalloc, … and a local WebKit checkout). Skips a sub-process configure entirely and lets LTO see across the dep boundary. `groups` are further flag sets (a cmake "target" each), `steps` are generators and target executables.
- `cargo` — (rule kept for out-of-workspace cargo deps; none today — lolhtml and rust-argon2 are path dependencies compiled as units of bun's own Rust graph).
- `prebuilt` — skip build entirely, download compiled `.a`/`.lib` (WebKit, nodejs-headers).

Expand All @@ -48,7 +48,7 @@ rule cc
depfile = $out.d
deps = gcc

build obj/src/foo.c.o: cc ../../src/foo.c | deps/zstd/libzstd.a || codegen/generated.h
build obj/src/foo.c.o: cc ../../src/foo.c | deps/cares/libcares.a || codegen/generated.h
cflags = -O2 -I...
```

Expand All @@ -60,9 +60,9 @@ rule dep_fetch
restat = 1
pool = dep

build ../../vendor/zstd/.ref: dep_fetch | ../../scripts/build/fetch-cli.ts
name = zstd
repo = facebook/zstd
build ../../vendor/zlib/.ref: dep_fetch | ../../scripts/build/fetch-cli.ts
name = zlib
repo = zlib-ng/zlib-ng
commit = abc123...
```

Expand Down Expand Up @@ -174,7 +174,7 @@ For `mode: "full"` (the normal case):

1. **Codegen** — `emitCodegen(n, cfg, sources, engine)` emits ~20 generation steps (bindgen, bundled modules, LUTs). Returns grouped outputs.
2. **Rust** — `emitRust(n, cfg, {...})` emits one rustc edge per crate and returns the crates' rlibs, `bun_runtime`'s and std's included, which the link takes beside the C/C++ objects (after resolving the vendored path deps, lolhtml and rust-argon2). cargo plans, ninja executes: the `rust_plan` edge runs `cargo build … --unit-graph` + `cargo metadata` for exactly the arguments `cargoBuildInvocation()` computes and writes `rust/plan.json`; `build.ninja` depends on that file, so a new plan (lockfile/manifest/toolchain change) reconfigures and ninja restarts. `rust/units.ts` turns each unit into a rustc argv/env (cargo's rules, transcribed and diffed against `cargo -vv`), written to `rust/units/<crate>-<hash>.json`; `rust/emit.ts` emits the edges; `rust/run.ts` executes them. Every edge is one process from start to exit, and a crate is one edge: one rustc with the `.rlib` and the `.rmeta` as outputs. Dependent libraries name only the `.rmeta`, which rustc writes long before it has generated code; the edge carries `early_output_prefix`, which asks ninja to release an output when the running command announces it. oven-sh/ninja (what the driver runs, see `ninja-release.ts`) exports the prefix to the command as `NINJA_EARLY_OUTPUT_PREFIX`, `rust/run.ts` prints it with the `.rmeta`'s path when rustc reports the file written, and dependents start while rustc goes on — cargo's pipelining. A stock ninja ignores the binding and releases both outputs at exit: the same graph, built correctly, without the overlap. Build scripts are a compile edge plus a `rust_build_script` run edge whose parsed directives (`output.json`, restat) feed the package's rustc edges. A Windows target has a second graph built the same way, under `rust/shim/`: the `.bin/` launcher (`src/install/windows-shim`), planned with `--profile shim` and `-Zbuild-std`, with a `bin` root that `run.ts` also writes to `<codegenDir>/bun-shim-impl.exe`, where `bun_install` embeds it from (every edge of that package waits for it). Codegen and Rust are emitted before the deps on purpose: with no `.ninja_log` (every CI build) ninja weighs each edge as 1 and runs the longest remaining chain first, ties in emission order.
3. **Deps** — loop `allDeps`, call `resolveDep(n, cfg, dep)`. Each emits fetch → direct cc/cxx edges, or fetch → cargo, or prebuilt download. Collects objects, lib paths, include dirs, outputs.
3. **Deps** — loop `allDeps`, call `resolveDep(n, cfg, dep)`. Each emits fetch → direct cc/cxx edges, or fetch → cargo, or prebuilt download. Collects objects, lib paths, include dirs, outputs. `programDeps` are resolved the same way, but nothing of them is collected for bun: only the programs beside it that name them take them.
4. **Flags** — `computeFlags(cfg)` evaluates flag tables → cflags/cxxflags/defines/ldflags/stripflags.
5. **PCH** — compile `root-pch.h` → PCH.
6. **Compile** — loop sources, `cxx()`/`cc()` per file.
Expand Down Expand Up @@ -259,7 +259,7 @@ It is configured by `configureCodegen()`, not `configure()`, and resolves a `Cod
| `glob-sources.ts` (parent dir) | Source glob patterns + CLI to print them |
| `ci-images/spec.ts` | CI's machines in one file: images, version pins, locations, every tool, and the generator of the bake scripts; `bun run ci:images` |
| `deps/*.ts` | One `Dependency` object per vendored dep |
| `deps/index.ts` | `allDeps` array — fetch order + link order |
| `deps/index.ts` | `allDeps` array — fetch order + link order; `programDeps` |
| `shims/*.c` | Platform workaround sources |
| `trim/*.ts` | The trimmable link: section graph, partition by feature, layout, the trim table (`link.ts` is the entry) |

Expand Down
8 changes: 6 additions & 2 deletions scripts/build/bun.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import { emitCodegen, type CodegenOutputs } from "./codegen.ts";
import { cc, cxx, link, pch, type PrecompiledHeader } from "./compile.ts";
import { bunExeName, shouldStrip, type Config } from "./config.ts";
import { generateDepVersionsHeader } from "./depVersionsHeader.ts";
import { allDeps } from "./deps/index.ts";
import { allDeps, programDeps } from "./deps/index.ts";
import { lolhtml } from "./deps/lolhtml.ts";
import { rustArgon2 } from "./deps/rust-argon2.ts";
import { jscPrograms, linuxIcuRoot, webkitEngineSources } from "./deps/webkit.ts";
Expand Down Expand Up @@ -197,6 +197,10 @@ export function emitBun(n: Ninja, cfg: Config, sources: Sources): BunOutput {
depsByName.set(dep.name, resolved);
}
}
for (const dep of programDeps) {
const resolved = resolveDep(n, cfg, dep, depsByName);
if (resolved !== null) depsByName.set(dep.name, resolved);
}

// Collect all dep lib paths, include dirs, output stamps, and directly-
// compiled source files (deps like picohttpparser that provide .c files
Expand Down Expand Up @@ -1138,7 +1142,7 @@ export function validateBunConfig(cfg: Config): void {
// --local-deps names must match a dep — a typo would otherwise silently
// build the pinned tarball while the banner claims `local:<typo>`.
// Keyed by string: these names are the user's.
const depsByName = new Map<string, Dependency>(allDeps.map(d => [d.name, d]));
const depsByName = new Map<string, Dependency>([...allDeps, ...programDeps].map(d => [d.name, d]));
for (const [name, path] of Object.entries(cfg.localDeps)) {
const dep = depsByName.get(name);
assert(dep !== undefined, `--local-deps: unknown dep '${name}'`, {
Expand Down
Loading
Loading