News for hackers. Stuff that matters.
Re:RX – a new random-access JSON alternative by squirrellous on Thursday March 19, 2026 @12:45AM (#47435055)
I agree in principle. However JSON tooling has also got so good that other formats, when not optimized and held correctly, can be worse than JSON. For example IME stock protocol buffers can be worse than a well optimized JSON library (as much as it pains me to say this).
Re:RX – a new random-access JSON alternative by tabwidth on Thursday March 19, 2026 @02:05AM (#47435532)
Yeah the raw parse speed comparison is almost a red herring at this point. The real cost with JSON is when you have a 200MB manifest or build artifact and you need exactly two fields out of it. You're still loading the whole thing into memory, building the full object graph, and GC gets to clean all of it up after. That's the part where something like RX with selective access actually matters. Parse speed benchmarks don't capture that at all.
Re:RX – a new random-access JSON alternative by xxs on Thursday March 19, 2026 @05:10AM (#47436697)
as parser: keep only indexes to the original file (input), dont copy strings or parse numbers at all (unless the strings fit in the index width, e.g. 32bit)

That would make parsing faster and there will be very little in terms on tree (json can't really contain full blow graphs) but it's rather complicated, and it will require hashing to allow navigation, though.

Re:RX – a new random-access JSON alternative by creationix on Thursday March 19, 2026 @01:45PM (#47443133)
yep. I built custom JSON parsers as a first solution. The problem is you can't get away from scanning at least half the document bytes on average.

With RX and other truly random-access formats you could even optimize to the point of not even fetching the whole document. You could grab chunks from a remote server using HTTP range requests and cache locally in fixed-width blocks.

With JSON you must start at the front and read byte-by-byte till you find all the data you're looking for. Smart parsers can help a lot to reduce heap allocations, but you can't skip the state machine scan.

Re:RX – a new random-access JSON alternative by magicalhippo on Thursday March 19, 2026 @08:23AM (#47438153)
> The real cost with JSON is when you have a 200MB manifest or build artifact and you need exactly two fields out of it.

There are SAX-like JSON libraries out there, and several of them work with a preallocated buffer or similar streaming interface, so you could stream the file and pick out the two fields as they come along.

Re:RX – a new random-access JSON alternative by IshKebab on Thursday March 19, 2026 @09:22AM (#47438985)
You still have to parse half the entire file on average. Much slower than formats that support skipping to the relevant information directly.
Re:RX – a new random-access JSON alternative by creationix on Thursday March 19, 2026 @10:04AM (#47439681)
yep, this is exactly the kind of use case that caused me to design this format.