James Snell's Avatar

James Snell

@jasnell.me

#FDJT. He/Him JavaScript In Depth - https://www.manning.com/books/javascript-in-depth

2,387
Followers
559
Following
944
Posts
25.04.2023
Joined
Posts Following

Latest posts by James Snell @jasnell.me

Ren - Vincent's Tale - Self Portrait
Ren - Vincent's Tale - Self Portrait YouTube video by Ren

Probably not what most would label "beautiful"... But I'm increasingly a fan of everything Ren publishes. The Vincent's Tale album is remarkable.

youtu.be/d-myXdYvu3w?...

07.03.2026 13:41 ๐Ÿ‘ 0 ๐Ÿ” 0 ๐Ÿ’ฌ 0 ๐Ÿ“Œ 0
Geordi La Forge says no to vibe coding, but yes to guide coding

Geordi La Forge says no to vibe coding, but yes to guide coding

My workflow with opencode/opus is always extremely interactive. It gets lost in the weeds so easily.

07.03.2026 13:17 ๐Ÿ‘ 2 ๐Ÿ” 0 ๐Ÿ’ฌ 1 ๐Ÿ“Œ 0

It's surprisingly good. Well worth it

07.03.2026 04:01 ๐Ÿ‘ 3 ๐Ÿ” 0 ๐Ÿ’ฌ 0 ๐Ÿ“Œ 0

So I'm going to be in NYC next week for TC39 and a Cloudflare onsite. Who is going to be around?

07.03.2026 02:01 ๐Ÿ‘ 7 ๐Ÿ” 0 ๐Ÿ’ฌ 1 ๐Ÿ“Œ 0

Not entirely accurate. It's more like crapping the pants. Then taking them off and wearing them like a shirt without cleaning them first.

06.03.2026 01:20 ๐Ÿ‘ 1 ๐Ÿ” 0 ๐Ÿ’ฌ 0 ๐Ÿ“Œ 0
Preview
Iranian warship sunk by the US was sailing home after taking part in an exhibition hosted by India Officials in New Delhi say that an Iranian warship that was sunk by a U.S. submarine near Sri Lanka had participated in naval exercises hosted by India before heading out into international waters in ...

So the US military is just out there sinking more ships that posed no threat no threat whatsoever to anyone. Murdering more innocent people for.... What?

apnews.com/article/iran...

05.03.2026 21:52 ๐Ÿ‘ 2 ๐Ÿ” 1 ๐Ÿ’ฌ 0 ๐Ÿ“Œ 0

All seemingly good improvements but can I point it at opencode and have opencode be the backend for this?

05.03.2026 16:06 ๐Ÿ‘ 2 ๐Ÿ” 0 ๐Ÿ’ฌ 1 ๐Ÿ“Œ 0
Post image

For the browser side... the benchmarks are a bit different but here's how it stacks up against chromium's impl of web streams:

03.03.2026 18:16 ๐Ÿ‘ 2 ๐Ÿ” 0 ๐Ÿ’ฌ 0 ๐Ÿ“Œ 0

In the runtime columns? just highlighting standouts.. it was flagging some improved numbers after making a few code changes.

03.03.2026 18:14 ๐Ÿ‘ 2 ๐Ÿ” 0 ๐Ÿ’ฌ 0 ๐Ÿ“Œ 0
Post image

Fixed up some perf issues and benchmark bugs in the new-streams reference impl ... some highlights running comparisons on @nodejs.org @deno.land and @bun.sh ... note each column is just looking at the one runtime, not comparing runtimes against each other ...

03.03.2026 18:01 ๐Ÿ‘ 13 ๐Ÿ” 2 ๐Ÿ’ฌ 2 ๐Ÿ“Œ 0

... but it's worth noting that the performance beats Node.js streams at the baseline and matches Node.js streams at the worst case. Both this and node.js streams are still roughly 2x faster that the non-optimized web streams impl that's currently in Node.js

02.03.2026 18:15 ๐Ÿ‘ 2 ๐Ÿ” 0 ๐Ÿ’ฌ 0 ๐Ÿ“Œ 0
Preview
[DRAFT] stream: prototype for new stream implementation by jasnell ยท Pull Request #62066 ยท nodejs/node Opening this for discussion. Not intending to land this yet. It adds an implementation of the "new streams" to core and adds support to FileHandle with tests and benchmarks just to explor...

Just to prove that it can fit in easily with existing implementation/runtimes fairly easily, I ported the github.com/jasnell/new-... API to Node.js and updated FileHandle to support it github.com/nodejs/node/... ... it's an experimental draft currently so no official status...

02.03.2026 18:15 ๐Ÿ‘ 9 ๐Ÿ” 1 ๐Ÿ’ฌ 1 ๐Ÿ“Œ 0
Preview
Improve renderToStream perf by batching chunks, closes #32 ยท mastrojs/mastro@c8b6675

@jasnell.me's blog post on streams made me finally add a buffer in Mastro's HTML streaming implementation.

This greatly reduces the number of chunks in the async iterable. Because there is a lot of per-chunk overhead, this brings our benchmark down from 25ยตs to 10ยตs ๐Ÿš€
github.com/mastrojs/mas...

01.03.2026 11:04 ๐Ÿ‘ 4 ๐Ÿ” 1 ๐Ÿ’ฌ 0 ๐Ÿ“Œ 0
Post image
02.03.2026 01:45 ๐Ÿ‘ 40 ๐Ÿ” 12 ๐Ÿ’ฌ 0 ๐Ÿ“Œ 0

My biggest question about this bullshit Iran thing is when the full Epstein files are going to be released.

02.03.2026 02:17 ๐Ÿ‘ 1 ๐Ÿ” 0 ๐Ÿ’ฌ 0 ๐Ÿ“Œ 0

So 3 US military and how many innocent Iranian civilians were killed because the orange turd continues to try to distract people from the Epstein files?

01.03.2026 18:08 ๐Ÿ‘ 0 ๐Ÿ” 0 ๐Ÿ’ฌ 1 ๐Ÿ“Œ 0

My biggest problem with them?

Every. Fucking. Thing.

ICE is state sponsored terrorism.

28.02.2026 18:17 ๐Ÿ‘ 6 ๐Ÿ” 0 ๐Ÿ’ฌ 0 ๐Ÿ“Œ 0

... And that's what we have now. I'll be taking a couple days to really go through Domenic's response and think through it. I hope others will do the same. Like I said, the alternative I put together is not a concrete proposal.. at least not yet. It's a demo that something else is viable.

28.02.2026 16:48 ๐Ÿ‘ 7 ๐Ÿ” 0 ๐Ÿ’ฌ 0 ๐Ÿ“Œ 0
On the Streams Standard A response to James Snell's "We deserve a better streams API for JavaScript", and a reflection on what it means to develop and implement web standards.

This is fantastic. Exactly the kind of discussion I was hoping for. This kind of critical response is what makes (and keeps) doing this important standards work fun domenic.me/streams-stan...

And let me be clear: I never claimed that this new idea is perfect. I wanted to start a conversation...

28.02.2026 16:48 ๐Ÿ‘ 34 ๐Ÿ” 2 ๐Ÿ’ฌ 1 ๐Ÿ“Œ 0

Some could argue, "You can do that with ReadableStream and WritableStream tho!" ... an yes, technically you can have `ReadableStream<Uint8Array[]>` but there's no way to discover if a `WritableStream` can *accept* an array of inputs; or, more specifically, no way discover what kind of inputs period.

28.02.2026 16:29 ๐Ÿ‘ 1 ๐Ÿ” 0 ๐Ÿ’ฌ 1 ๐Ÿ“Œ 0

If it were `AsyncIterable<Uint8Array>`, then I would either (a) be forced to concat or (b) be forced to yield only one chunk at a time... I want to avoid both.

28.02.2026 16:28 ๐Ÿ‘ 1 ๐Ÿ” 0 ๐Ÿ’ฌ 1 ๐Ÿ“Œ 0

... I can then just skip the cost of concat (allocation + copy) and just perform a vectored write to the lower levels. This reduces the additional promise and microtask hops, skips copy and allocation costs, reduces roundtrips through the write loop, etc.. and overall makes the data pump faster

28.02.2026 16:27 ๐Ÿ‘ 3 ๐Ÿ” 0 ๐Ÿ’ฌ 1 ๐Ÿ“Œ 0
Use draining read in standard.c++ pumpTo impl by jasnell ยท Pull Request #6119 ยท cloudflare/workerd Part of ongoing incremental perf improvements. This updates the standard-&gt;to-&gt;internal pumpTo loop (consuming a JS readable stream and writing the data to a kj destination) to use the new dra...

Here's an example of the principle in action: github.com/cloudflare/w... ... in this PR I'm changing the way Cloudflare Workers drains ReadableStream buffer on the internal path. Instead of reading one chunk at a time, if there are multiple chunks available I grab as many as I can synchronously...

28.02.2026 16:27 ๐Ÿ‘ 1 ๐Ÿ” 0 ๐Ÿ’ฌ 1 ๐Ÿ“Œ 0

... Web streams forces you down a path of one at a time because there's no way to discover if you can get many or not. Explicitly building this into the API makes it far easier to amortize the performance costs and build perf improvements into the design

28.02.2026 16:23 ๐Ÿ‘ 1 ๐Ÿ” 0 ๐Ÿ’ฌ 1 ๐Ÿ“Œ 0

Key challenge is that the language does not yet have an ultra efficient way to concatenate these chunks... And you don't always want to anyway. This gives the implementation options. You can give one, or give many based on what is available now and what you need...

28.02.2026 16:23 ๐Ÿ‘ 2 ๐Ÿ” 0 ๐Ÿ’ฌ 1 ๐Ÿ“Œ 0

Oh, and I was on a podcast talking about how we're finally getting close to enabling pointer compression in node.js

27.02.2026 18:13 ๐Ÿ‘ 4 ๐Ÿ” 1 ๐Ÿ’ฌ 0 ๐Ÿ“Œ 0

Have always loved @dominictarr.bsky.social's take on all this

27.02.2026 17:46 ๐Ÿ‘ 0 ๐Ÿ” 0 ๐Ÿ’ฌ 1 ๐Ÿ“Œ 0

... That all said, the alternative approach is not always faster, and in some benchmarks comes out slightly slower depending on the runtime. There are many factors so I don't want to make this purely about a perf difference. Personally, I think the API DX is the more significant factor.

27.02.2026 17:24 ๐Ÿ‘ 3 ๐Ÿ” 0 ๐Ÿ’ฌ 0 ๐Ÿ“Œ 0
Post image

... and Bun's numbers...

27.02.2026 17:24 ๐Ÿ‘ 2 ๐Ÿ” 0 ๐Ÿ’ฌ 1 ๐Ÿ“Œ 0
Post image

... Obviously, take all the usual "Benchmarks are usually fundamentally flawed" caveats into consideration when looking at those numbers. Also, these are the numbers when checked against Node.js. What do the numbers with Deno and Bun look like?

Here are Deno's numbers for the same benchmarks:

27.02.2026 17:24 ๐Ÿ‘ 1 ๐Ÿ” 0 ๐Ÿ’ฌ 1 ๐Ÿ“Œ 0