HN user

Jarred

7,409 karma

Bun is hiring engineers

https://bun.com

jobs@bun.sh

Posts196
Comments451
View on HN
github.com 2y ago

The Fil-C Manifesto: Garbage In, Memory Safety Out

Jarred
13pts17
bun.sh 2y ago

Bun 1.0

Jarred
13pts0
www.phoronix.com 3y ago

Readfile System Call Revised for Efficiently Reading Small Files

Jarred
1pts0
github.com 4y ago

All About Libpas, Phil's Super Fast Malloc

Jarred
287pts81
github.com 5y ago

fs.promises.readFile is 40% slower than fs.readFile

Jarred
145pts74
github.com 5y ago

Show HN: git-peek – git repo to local editor instantly

Jarred
114pts36
www.kickstarter.com 5y ago

Light Table (2014)

Jarred
2pts0
github.com 5y ago

Node.js test runners performance comparison

Jarred
2pts0
github.com 5y ago

Show HN: AtBuild – write JavaScript that generates JavaScript

Jarred
1pts0
emilk.github.io 5y ago

Egui: Experimental immediate mode GUI library written in Rust

Jarred
6pts1
github.com 5y ago

Doc: Mark ECMAScript modules implementation as stable

Jarred
1pts0
zeux.io 5y ago

Is C++ Fast? (2019)

Jarred
2pts0
moxie.org 5y ago

The Worst (2012)

Jarred
1pts0
trac.webkit.org 5y ago

Enable WebGL2 by Default in Safari

Jarred
1pts0
www.nytimes.com 5y ago

India’s ‘Phone Romeos’ Look for Ms. Right via Wrong Numbers (2017)

Jarred
1pts0
github.com 5y ago

mudb: Low latency state replication for the web

Jarred
2pts0
firt.dev 5y ago

Safari on iOS 14 and iPadOS 14 for PWA and Web Developers

Jarred
3pts0
github.com 5y ago

AutoCXX: Safely call C++ from Rust with auto generated bindings

Jarred
174pts143
github.com 5y ago

RequestPostAnimationFrame

Jarred
1pts0
github.com 5y ago

Kiwi Message Format

Jarred
2pts0
noclip.website 6y ago

Noclip.website – Explore game maps in-browser

Jarred
2pts1
www.eff.org 6y ago

EFF to Supreme Court: Violating Terms of Service Isn’t a Crime Under the CFAA

Jarred
119pts29
wicg.github.io 6y ago

WebTransport API

Jarred
113pts66
www.microsoft.com 6y ago

Say Goodbye to WordArt (2012)

Jarred
3pts0
twitter.com 6y ago

Disney+ EU launch delayed due to fear of “breaking the internet”

Jarred
3pts0
forums.developer.apple.com 6y ago

Apple is rejecting Coronavirus apps from the App Store

Jarred
3pts2
github.com 6y ago

Destiny – Prettier for File Structures (JavaScript Only)

Jarred
2pts0
github.com 6y ago

Jailbreak for iOS 13.3 (A12-A13)

Jarred
1pts0
www.nytimes.com 6y ago

Twitter Made Us Better

Jarred
1pts0
github.com 6y ago

Hippy: React Native Alternative by Tencent

Jarred
98pts68

Grouped and arena allocations work really well in Zig. For awhile, we tried to use this pattern almost everywhere in Bun but it gets really tricky when there’s some GC-managed memory and you want to free things incrementally to reduce RSS. Also, using arenas for arrays that grow wastes memory a lot since it keeps every previous version around (mimalloc arenas are slightly better for this)

Grouped allocations works especially well in parsers & ASTs where the lifetime is very bounded. Since the Rust rewrite, we still use arenas for Bun’s parsers and the bundler but not a ton elsewhere.

I have learned so much reading Andrew’s code and as I said in the original post: Bun would never have happened without Zig.

The post claims they were fuzzing their Zig code, while during our calls the whole Bun team told us that they were not fuzzing anything. This appears to be an outright fabrication.

Fuzzilli integration: https://github.com/oven-sh/bun/pull/24826

Merged PRs fixing issues Fuzzilli found in Bun’s Zig code:

- https://github.com/oven-sh/bun/pull/28926

- https://github.com/oven-sh/bun/pull/28934

- https://github.com/oven-sh/bun/pull/29255

- https://github.com/oven-sh/bun/pull/29210

- https://github.com/oven-sh/bun/pull/29199

Searching “Fuzzilli” shows more PRs: https://github.com/search?q=repo%3Aoven-sh%2Fbun+is%3Apr+Fuz...

I’m the author of this PR.

This PR is an implementation of the design from https://webkit.org/blog/7846/concurrent-javascript-it-can-wo.... I think it would be really cool if JavaScript had true shared object multi-threading without compromises (SharedArrayBuffer, postMessage are not that). If we had both threads and structs, it’s likely the TypeScript compiler would never have needed to be rewritten in Go.

The title should be changed to clarify that it’s a PR to Bun’s JavaScriptCore fork and not the upstream WebKit.

This PR is scarier to merge than Bun’s Rust rewrite PR. There are a good number of benchmarks/stress tests, unit tests, and also TSAN runs and security scanner runs, but this is a more complex change than the Rust rewrite (yes, really). I’m also worried about syncing with upstream - today the “fork” is mostly a bunch of patches, but with this PR, changes to the JIT need to be reviewed for behavior when multiple threads are in use. Our best bet for this to move forward is figuring out a way for some constrained version to be upstreamed into WebKit proper, if that makes sense and if they’re interested.

And yes, the PR description is entirely Claude.

Dynamic workflows, in my experience, make Claude more effective at complex long-running tasks. They help precisely with getting Claude to do the task correctly.

It feels more like a bespoke build system for the specific task/project than prompting a freeform chat.

`PathString` worked the exact same way in our Zig code, with less visibility from the compiler & type system. And yes, it will be refactored heavily (or deleted overall) in the next week or so.

mostly a JavaScript interpreter wrapper

Not accurate. Bun is a batteries-included JavaScript & CSS transpiler (parser), minifier, bundler, npm-like package manager, Jest-like test runner, as well as runtime APIs like a builtin Postgres, MySQL and Redis client. This is naturally a ton of code.

it's basically solving the ,,tests not pass'' problem by changing the tests themselves.

False.

0 test files were deleted. 0 pre-existing tests were skipped, todo’d, or had assertions removed. 5 new tests were added in test.skip/test.todo state to track known not-yet-fixed bugs in the port that lacked test coverage before.

The merge changed 28 test files in total.

+1,312 lines

−141 lines

Most of that +1,312 is new tests.

The depth-of-recursion tests for TOML/JSONC parsers went from 25_000 -> 200_000 because Rust’s smaller stack frames (LLVM lifetime annotations let the optimizer reuse stack slots) mean 25k levels no longer reaches the 18 MB stack on Windows.

Still writing the blog post about this. Will share more details.

For where this is coming from, skim the bugfixes in the Bun v1.3.14 and earlier release notes. Rust won’t catch all of these - leaks from holding references too long and anything that re-enters across the JS boundary are still on us. But a large % of that list is use-after-free, double-free, and forgot-to-free-on-error-path, which become compile errors or automatic cleanup.

I work on Bun and this is my branch

This whole thread is an overreaction. 302 comments about code that does not work. We haven’t committed to rewriting. There’s a very high chance all this code gets thrown out completely.

I’m curious to see what a working version of this looks, what it feels like, how it performs and if/how hard it’d be to get it to pass Bun’s test suite and be maintainable. I’d like to be able to compare a viable Rust version and a Zig version side by side.

I work on Bun, and this post is confusing to me. Me personally and the Bun team continues to dogfood & make Bun better everyday. Our development pace has only gotten faster. Bun's stability has improved significantly since joining Anthropic.

Here are some things shipping in the next version of Bun:

- 17 MB smaller Windows x64 binaries [0]

- 8 MB smaller Linux binaries [1]

- `--no-orphans` CLI flag to recursively kill any lingering processes spawned [3]

- SSL context caching for client TCP & unix sockets, which significantly reduces memory usage for database clients like Mongoose/MongoDB [4]

- Experimental HTTP/3 & HTTP/2 client in fetch [5]

- Experimental HTTP/3 support in Bun.serve() [6]

- Bun.Image, a builtin image processing library [7]

(Along with several reliability improvements to node:fs, Worker, BroadcastChannel, and MessagePort)

The Anthropic acquisition also means Bun no longer needs to become a revenue-generating business. We are very incentivized to make Bun better because Claude Code depends on it, and so many software engineers depend on Claude Code to help get their work done.

[0] https://github.com/oven-sh/bun/pull/30219

[1] https://github.com/oven-sh/bun/pull/30098

[2] https://github.com/oven-sh/WebKit/pull/211

[3] https://github.com/oven-sh/bun/pull/29930

[4] https://github.com/oven-sh/bun/pull/29932

[5] https://github.com/oven-sh/bun/pull/29863

[6] https://github.com/oven-sh/bun/pull/30032

You can find a comparison with `bun build` on Bun's homepage. It hasn't been updated in a little while, but I haven't heard that the relative difference between Bun and Rolldown has changed much in the time since (both have gotten faster).

In text form:

Bundling 10,000 React components (Linux x64, Hetzner)

  Bundler                    Version                  Time
  ─────────────────────────────────────────────────────────
  Bun                        v1.3.0               269.1 ms
  Rolldown                   v1.0.0-beta.42       494.9 ms
  esbuild                    v0.25.10             571.9 ms
  Farm                       v1.0.5             1,608.0 ms
  Rspack                     v1.5.8             2,137.0 ms

I have a PR that’s been sitting for awhile that exposes the extra options from the renameat2 and renameatx_np syscalls which is a good way to implement self-updaters that work even when multiple processes are updating the same path on disk at the same time. These syscalls are supported on Linux & macOS but I don’t think there’s an equivalent on Windows. We use these syscalls internally for `bun install` to make adding packages into the global install cache work when multiple `bun install` processes are running simultaneously

No high-level self updater api is planned right now, but yes for at least the low level parts needed to make a good one

The reference docs are auto generated from node’s TypeScript types. node:vm is better than using the same global object to run untrusted code, but it’s not really a sandbox

Probably not. When we add new APIs in Bun, we generally base the interface off of popular existing packages. The bar is very high for a runtime to include libraries because the expectation is to support those APIs ~forever. And I can’t think of popular existing JS libraries for these things.

undermine your confidence in Zig

Nah

I do think the combo of not using Twitter, not using Discord, and not using GitHub does make it a bit more challenging for Zig to become a mainstream programming language. Twitter being the least important amongst those. Hard to say how much it matters in practice, as things tend to win on their strengths and not on lack of weakness

Playwright support will improve soon. We are rewriting node:http’s client implementation to pass node’s test suite. Expecting that to land next week.