Benchmark
JSON against jalapenojson: the same rows, read and written by each, in JavaScript, Python and C. Every table has the same shape: JSON in one column, jalapenojson in the next, and how many times faster or slower jalapenojson is. The reads are timed with the parse, which is what reading a document once costs, and in JavaScript, Python and C again on a document parsed once, before the clock starts, which is what each read costs a process that keeps the document. In JavaScript and Python that is done both ways jalapenojson can keep one: as the table view() opens, and as the rows decode() makes. WebAssembly was not measured for this version; its section says why.
Measured on 2026-10-13 at commit 478ac17: Intel Xeon Processor @ 2.80GHz, 4 cores, Linux 6.18.44-fc-v114; Node 22.22.0, Python 3.13.16, cc (Ubuntu 13.3.0-6ubuntu2~24.04.1) 13.3.0 with -O2, cJSON 1.7.19, yyjson 0.13.0. Reproduce with bench/run.sh.
The data
Two sets of rows with the same seven columns: id (i), user, city and plan (s), seats (i), price (f) and joined (d). They are never averaged, because they disagree about size.
- repetitive is the shape API output usually has: a user drawn from two thousand, a city from eight (one of them Tromsø, so the text is not pure ASCII), a plan from four, a price from a price list.
- high-entropy fills the same columns with random letters and numbers, so there is little for a compressor to find in either format.
- nested orders, orders carrying one to six line items each, is measured for size only.
bench/data.mjs writes each set once, as JSON and as jalapenojson, and every language reads those same files.
jalapenojson stores the values column by column, every column at a fixed size: id and seats as binary integers as narrow as their values allow, price as an 8-byte double, joined as a 4-byte count of days since 1970-01-01, and each text column as wide as its longest value, with a NUL after a shorter one. At 50,000 rows the schema lines are:
repetitive #id:i:4 #user:s:9 #city:s:12 #plan:s:10 #seats:i:1 #price:f:8 #joined:d:4
high-entropy #id:i:4 #user:s:16 #city:s:14 #plan:s:10 #seats:i:4 #price:f:8 #joined:d:4
Size
Raw, then compressed the way a server would send it: gzip at level 6, brotli at quality 5 (compressed as it is sent) and 11 (compressed once, ahead of time).
| 50,000 rows | JSON | jalapenojson | difference |
|---|
| repetitive, raw | 5.55 MB | 2.40 MB | 57% smaller |
| repetitive, gzip | 609 KB | 430 KB | 29% smaller |
| repetitive, brotli 5 | 609 KB | 375 KB | 38% smaller |
| repetitive, brotli 11 | 460 KB | 323 KB | 30% smaller |
| high-entropy, raw | 6.27 MB | 3.00 MB | 52% smaller |
| high-entropy, gzip | 2.27 MB | 1.90 MB | 16% smaller |
| high-entropy, brotli 5 | 2.20 MB | 1.79 MB | 19% smaller |
| high-entropy, brotli 11 | 2.01 MB | 1.68 MB | 16% smaller |
| nested orders, raw | 12.04 MB | 5.49 MB | 54% smaller |
| nested orders, gzip | 1.78 MB | 1.43 MB | 20% smaller |
| nested orders, brotli 5 | 1.72 MB | 1.35 MB | 22% smaller |
| nested orders, brotli 11 | 1.39 MB | 1.08 MB | 22% smaller |
JavaScript
JSON.parse and JSON.stringify against decode(), view() and encode(), on Node 22.22.0. Warmed up: the fastest run once the reader has run for 200 ms, which is what a server or a page that reads many documents sees.
- read every value builds every row as an object:
JSON.parse against decode(). - read every value, as columns ends with one array per column:
JSON.parse and a pass per column, against view() and column(). - read one number column ends with the values of
price: JSON.parse and a pass, against view() and numbers(). numbers() is how a number column is read in JavaScript: it checks that every value is finite and hands back a Float64Array. That is a view over the document's own bytes when the column starts at a multiple of 8 in memory, and a copy otherwise, since JavaScript makes a Float64Array only there. In both documents price starts at a byte that is not a multiple of 8, so it is a copy. - read one text column ends with the values of
city: JSON.parse and a pass, against view() and column(). - read one row ends with each value of the middle row, in column order:
JSON.parse and Object.values() of that row, against view() and a get() per column, which builds no row object. - write every value turns the rows each reader built back into bytes:
JSON.stringify and a TextEncoder, against encode().
| 50,000 rows | data | JSON | jalapenojson | difference |
|---|
| read every value | repetitive | 47.3 ms | 12.9 ms | 3.7x faster |
| high-entropy | 45.6 ms | 12.4 ms | 3.7x faster |
| read every value, as columns | repetitive | 58.0 ms | 11.2 ms | 5.2x faster |
| high-entropy | 57.9 ms | 10.5 ms | 5.5x faster |
| read one number column | repetitive | 49.8 ms | 0.099 ms | 501x faster |
| high-entropy | 50.0 ms | 0.110 ms | 456x faster |
| read one text column | repetitive | 49.5 ms | 4.71 ms | 11x faster |
| high-entropy | 49.3 ms | 2.25 ms | 22x faster |
| read one row | repetitive | 47.3 ms | 0.0035 ms | 13,602x faster |
| high-entropy | 46.4 ms | 0.0036 ms | 12,929x faster |
| write every value | repetitive | 29.7 ms | 9.96 ms | 3.0x faster |
| high-entropy | 28.2 ms | 11.9 ms | 2.4x faster |
JSON's time includes turning the bytes into the string JSON.parse takes, because jalapenojson's includes reading the same bytes. Handed a string it already has, JSON.parse alone takes 31.5 ms on the repetitive rows and 41.3 ms on the high-entropy rows at 50,000 rows.
Parsed once, then read
Every table above times the parse with the reading, which is what reading a document once costs. A process that keeps a document and reads it many times pays for the parse once and then for the reading alone, so here the parse runs once, before the clock starts, and every run reads from what it made. JSON.parse makes rows that are objects already, while view() reads the header and converts each value from the document's bytes when it is asked for, so a text value is decoded, and a date spelled out, on every read. A JavaScript string cannot point into the document's bytes, so every text value read is made into a new string, where JSON.parse made each one once. A number column makes one typed array per read: numbers() views the document's own bytes when the column starts at a multiple of 8 in memory, and copies them otherwise, as it does for price here. The first line is the parse alone. The last column says after how many reads JSON's total, its parse and then its reads, comes out the smaller, or never, where jalapenojson's reads are the quicker too. Reading every value as rows is not here: JSON.parse's rows are that already, so nothing would be left to time, and decode() builds the same rows once, after which the two are the same objects.
| 50,000 rows, parsed once | data | JSON | jalapenojson | difference | JSON catches up |
|---|
| parse it | repetitive | 47.3 ms | 0.0028 ms | 17,154x faster | |
| high-entropy | 45.6 ms | 0.0028 ms | 16,502x faster | |
| then read every value, as columns | repetitive | 7.94 ms | 11.2 ms | 1.4x slower | after 15 reads |
| high-entropy | 8.02 ms | 10.5 ms | 1.3x slower | after 19 reads |
| then read one number column | repetitive | 1.34 ms | 0.097 ms | 14x faster | never |
| high-entropy | 1.12 ms | 0.100 ms | 11x faster | never |
| then read one text column | repetitive | 0.735 ms | 4.66 ms | 6.3x slower | after 13 reads |
| high-entropy | 0.766 ms | 2.20 ms | 2.9x slower | after 32 reads |
| then read one row | repetitive | 0.00014 ms | 0.00056 ms | 3.9x slower | after 110,000 reads |
| high-entropy | 0.00014 ms | 0.00059 ms | 4.1x slower | after 100,000 reads |
| 1,000 rows, parsed once | data | JSON | jalapenojson | difference | JSON catches up |
|---|
| parse it | repetitive | 0.801 ms | 0.0028 ms | 290x faster | |
| high-entropy | 0.555 ms | 0.0028 ms | 197x faster | |
| then read every value, as columns | repetitive | 0.066 ms | 0.155 ms | 2.3x slower | after 10 reads |
| high-entropy | 0.066 ms | 0.137 ms | 2.1x slower | after 8 reads |
| then read one number column | repetitive | 0.0036 ms | 0.0025 ms | 1.4x faster | never |
| high-entropy | 0.0036 ms | 0.0024 ms | 1.5x faster | never |
| then read one text column | repetitive | 0.0034 ms | 0.063 ms | 19x slower | after 14 reads |
| high-entropy | 0.0034 ms | 0.022 ms | 6.5x slower | after 30 reads |
| then read one row | repetitive | 0.00014 ms | 0.00056 ms | 4.0x slower | after 1,900 reads |
| high-entropy | 0.00014 ms | 0.00064 ms | 4.5x slower | after 1,100 reads |
Decoded once, then read
The other way to keep a jalapenojson document is to decode it once, as JSON is parsed once, and keep its rows. Here decode() runs once, before the clock starts, and every run reads its rows with the code that reads JSON's above. The first line is each parse alone, the same as reading every value in the first table. The last column says after how many reads JSON's total comes out the smaller, or never, where the reads are about the same or quicker. Its rows are plain objects, as JSON.parse's are, with each date as its text.
| 50,000 rows, decoded once | data | JSON | jalapenojson | difference | JSON catches up |
|---|
| parse it | repetitive | 47.3 ms | 12.9 ms | 3.7x faster | |
| high-entropy | 45.6 ms | 12.4 ms | 3.7x faster | |
| then read every value, as columns | repetitive | 7.94 ms | 7.36 ms | 1.1x faster | never |
| high-entropy | 8.02 ms | 7.45 ms | 1.1x faster | never |
| then read one number column | repetitive | 1.34 ms | 1.27 ms | 1.1x faster | never |
| high-entropy | 1.12 ms | 1.03 ms | 1.1x faster | never |
| then read one text column | repetitive | 0.735 ms | 0.621 ms | 1.2x faster | never |
| high-entropy | 0.766 ms | 0.623 ms | 1.2x faster | never |
| then read one row | repetitive | 0.00014 ms | 0.00014 ms | about the same | never |
| high-entropy | 0.00014 ms | 0.00014 ms | about the same | never |
| 1,000 rows, decoded once | data | JSON | jalapenojson | difference | JSON catches up |
|---|
| parse it | repetitive | 0.801 ms | 0.176 ms | 4.5x faster | |
| high-entropy | 0.555 ms | 0.156 ms | 3.6x faster | |
| then read every value, as columns | repetitive | 0.066 ms | 0.067 ms | about the same | never |
| high-entropy | 0.066 ms | 0.065 ms | about the same | never |
| then read one number column | repetitive | 0.0036 ms | 0.0034 ms | 1.1x faster | never |
| high-entropy | 0.0036 ms | 0.0035 ms | about the same | never |
| then read one text column | repetitive | 0.0034 ms | 0.0032 ms | 1.1x faster | never |
| high-entropy | 0.0034 ms | 0.0032 ms | 1.1x faster | never |
| then read one row | repetitive | 0.00014 ms | 0.00014 ms | about the same | never |
| high-entropy | 0.00014 ms | 0.00014 ms | about the same | never |
The first call
A page that reads one document reads it once, in a process that has never run the reader: V8 compiles a JavaScript reader as it goes, while JSON.parse is already machine code. Each number is the median of one run in each of several fresh processes.
| 1,000 rows, first call | data | JSON | jalapenojson | difference |
|---|
| read every value | repetitive | 1.57 ms | 4.50 ms | 2.9x slower |
| high-entropy | 1.25 ms | 4.96 ms | 4.0x slower |
| read one number column | repetitive | 1.62 ms | 1.11 ms | 1.5x faster |
| high-entropy | 1.41 ms | 1.12 ms | 1.3x faster |
| read one text column | repetitive | 1.60 ms | 1.67 ms | about the same |
| high-entropy | 1.36 ms | 1.66 ms | 1.2x slower |
| read one row | repetitive | 1.56 ms | 1.13 ms | 1.4x faster |
| high-entropy | 1.47 ms | 1.29 ms | 1.1x faster |
| 50,000 rows, first call | data | JSON | jalapenojson | difference |
|---|
| read every value | repetitive | 72.1 ms | 43.3 ms | 1.7x faster |
| high-entropy | 71.2 ms | 44.2 ms | 1.6x faster |
| read one number column | repetitive | 71.8 ms | 2.75 ms | 26x faster |
| high-entropy | 70.7 ms | 2.67 ms | 26x faster |
| read one text column | repetitive | 71.4 ms | 12.3 ms | 5.8x faster |
| high-entropy | 76.2 ms | 11.4 ms | 6.7x faster |
| read one row | repetitive | 67.2 ms | 1.19 ms | 56x faster |
| high-entropy | 71.2 ms | 1.34 ms | 53x faster |
1,000 rows
| 1,000 rows | data | JSON | jalapenojson | difference |
|---|
| read every value | repetitive | 0.801 ms | 0.176 ms | 4.5x faster |
| high-entropy | 0.555 ms | 0.156 ms | 3.6x faster |
| read every value, as columns | repetitive | 0.903 ms | 0.160 ms | 5.7x faster |
| high-entropy | 0.662 ms | 0.143 ms | 4.6x faster |
| read one number column | repetitive | 0.832 ms | 0.0048 ms | 175x faster |
| high-entropy | 0.565 ms | 0.0050 ms | 113x faster |
| read one text column | repetitive | 0.817 ms | 0.067 ms | 12x faster |
| high-entropy | 0.562 ms | 0.026 ms | 21x faster |
| read one row | repetitive | 0.802 ms | 0.0035 ms | 228x faster |
| high-entropy | 0.533 ms | 0.0036 ms | 146x faster |
| write every value | repetitive | 0.387 ms | 0.189 ms | 2.0x faster |
| high-entropy | 0.388 ms | 0.217 ms | 1.8x faster |
In a browser
Everything above starts with the bytes in memory. A page has to receive them first. Chromium 141.0.7390.37, driven by Playwright, fetches each document from a local server that sends it gzipped, over a connection DevTools slows to a given speed and latency, and then reads it with the JavaScript section's calls: what a page that fetches one document waits for. The download is the fastest of three; the read is the first one a fresh page does, the median of several pages.
| 50,000 rows, fast 4G (9 Mbit/s, 85 ms) | data | JSON | jalapenojson | difference |
|---|
| receive the document | repetitive | 661 ms | 487 ms | 1.4x faster |
| high-entropy | 2,144 ms | 1,798 ms | 1.2x faster |
| receive it and read every value | repetitive | 712 ms | 524 ms | 1.4x faster |
| high-entropy | 2,192 ms | 1,831 ms | 1.2x faster |
| receive it and read one number column | repetitive | 702 ms | 490 ms | 1.4x faster |
| high-entropy | 2,197 ms | 1,800 ms | 1.2x faster |
| receive it and read one row | repetitive | 701 ms | 488 ms | 1.4x faster |
| high-entropy | 2,189 ms | 1,799 ms | 1.2x faster |
| 50,000 rows, slow link (1.6 Mbit/s, 150 ms) | data | JSON | jalapenojson | difference |
|---|
| receive the document | repetitive | 3,226 ms | 2,317 ms | 1.4x faster |
| high-entropy | 11,544 ms | 9,657 ms | 1.2x faster |
| receive it and read every value | repetitive | 3,276 ms | 2,353 ms | 1.4x faster |
| high-entropy | 11,592 ms | 9,691 ms | 1.2x faster |
| receive it and read one number column | repetitive | 3,267 ms | 2,320 ms | 1.4x faster |
| high-entropy | 11,598 ms | 9,660 ms | 1.2x faster |
| receive it and read one row | repetitive | 3,265 ms | 2,318 ms | 1.4x faster |
| high-entropy | 11,589 ms | 9,659 ms | 1.2x faster |
At 50,000 rows on fast 4G, reading every value is 7% with JSON and 7% with jalapenojson on the repetitive rows, and 2% with JSON and 2% with jalapenojson on the high-entropy rows, of what the page waits for. The rest is the download.
| 1,000 rows, fast 4G (9 Mbit/s, 85 ms) | data | JSON | jalapenojson | difference |
|---|
| receive the document | repetitive | 100 ms | 97.4 ms | about the same |
| high-entropy | 130 ms | 124 ms | about the same |
| receive it and read every value | repetitive | 101 ms | 101 ms | about the same |
| high-entropy | 131 ms | 130 ms | about the same |
| receive it and read one number column | repetitive | 101 ms | 99.1 ms | about the same |
| high-entropy | 131 ms | 126 ms | about the same |
| receive it and read one row | repetitive | 101 ms | 98.7 ms | about the same |
| high-entropy | 131 ms | 126 ms | about the same |
| 1,000 rows, slow link (1.6 Mbit/s, 150 ms) | data | JSON | jalapenojson | difference |
|---|
| receive the document | repetitive | 217 ms | 202 ms | 1.1x faster |
| high-entropy | 382 ms | 352 ms | 1.1x faster |
| receive it and read every value | repetitive | 218 ms | 206 ms | 1.1x faster |
| high-entropy | 383 ms | 358 ms | 1.1x faster |
| receive it and read one number column | repetitive | 218 ms | 204 ms | 1.1x faster |
| high-entropy | 383 ms | 354 ms | 1.1x faster |
| receive it and read one row | repetitive | 218 ms | 203 ms | 1.1x faster |
| high-entropy | 383 ms | 354 ms | 1.1x faster |
At 1,000 rows on fast 4G, reading every value is under 1% with JSON and 4% with jalapenojson on the repetitive rows, and under 1% with JSON and 4% with jalapenojson on the high-entropy rows, of what the page waits for. The rest is the download.
Python
json.loads and json.dumps against decode(), view() and encode(), on Python 3.13.16. The same tasks, warmed up the same way. Python's json is written in C; jalapenojson's Python reader is Python. It has no typed-array call, so read one number column is view() and column(), which converts the whole column at once. JSON is written compact and as UTF-8, the way the file it was read from was.
| 50,000 rows | data | JSON | jalapenojson | difference |
|---|
| read every value | repetitive | 77.7 ms | 45.0 ms | 1.7x faster |
| high-entropy | 73.3 ms | 61.9 ms | 1.2x faster |
| read every value, as columns | repetitive | 123 ms | 19.1 ms | 6.4x faster |
| high-entropy | 119 ms | 30.4 ms | 3.9x faster |
| read one number column | repetitive | 77.5 ms | 0.665 ms | 116x faster |
| high-entropy | 72.1 ms | 0.675 ms | 107x faster |
| read one text column | repetitive | 85.1 ms | 6.25 ms | 14x faster |
| high-entropy | 75.2 ms | 5.41 ms | 14x faster |
| read one row | repetitive | 74.4 ms | 0.033 ms | 2,269x faster |
| high-entropy | 68.7 ms | 0.033 ms | 2,096x faster |
| write every value | repetitive | 62.4 ms | 41.0 ms | 1.5x faster |
| high-entropy | 67.5 ms | 45.0 ms | 1.5x faster |
Parsed once, then read
The same as in JavaScript: json.loads and view() run once, before the clock starts, and the reads are the ones above with the parse taken out, but for reading every value as rows, which json.loads has done already. As in JavaScript, every text value view() reads is made into a new string, where json.loads made each one once. The first line is the parse alone. The last column says after how many reads JSON's total, its parse and then its reads, comes out the smaller, or never, where jalapenojson's reads are the quicker too.
| 50,000 rows, parsed once | data | JSON | jalapenojson | difference | JSON catches up |
|---|
| parse it | repetitive | 77.7 ms | 0.025 ms | 3,136x faster | |
| high-entropy | 73.3 ms | 0.025 ms | 2,957x faster | |
| then read every value, as columns | repetitive | 14.6 ms | 19.1 ms | 1.3x slower | after 18 reads |
| high-entropy | 17.1 ms | 29.7 ms | 1.7x slower | after 6 reads |
| then read one number column | repetitive | 3.29 ms | 0.619 ms | 5.3x faster | never |
| high-entropy | 2.50 ms | 0.613 ms | 4.1x faster | never |
| then read one text column | repetitive | 2.48 ms | 6.08 ms | 2.4x slower | after 22 reads |
| high-entropy | 2.25 ms | 5.39 ms | 2.4x slower | after 24 reads |
| then read one row | repetitive | 0.00021 ms | 0.0044 ms | 21x slower | after 18,000 reads |
| high-entropy | 0.00021 ms | 0.0044 ms | 21x slower | after 17,000 reads |
| 1,000 rows, parsed once | data | JSON | jalapenojson | difference | JSON catches up |
|---|
| parse it | repetitive | 1.14 ms | 0.025 ms | 46x faster | |
| high-entropy | 1.05 ms | 0.025 ms | 43x faster | |
| then read every value, as columns | repetitive | 0.187 ms | 0.387 ms | 2.1x slower | after 6 reads |
| high-entropy | 0.188 ms | 0.495 ms | 2.6x slower | after 4 reads |
| then read one number column | repetitive | 0.030 ms | 0.013 ms | 2.3x faster | never |
| high-entropy | 0.028 ms | 0.013 ms | 2.1x faster | never |
| then read one text column | repetitive | 0.028 ms | 0.090 ms | 3.2x slower | after 19 reads |
| high-entropy | 0.027 ms | 0.078 ms | 2.9x slower | after 21 reads |
| then read one row | repetitive | 0.00021 ms | 0.0044 ms | 22x slower | after 270 reads |
| high-entropy | 0.00021 ms | 0.0044 ms | 21x slower | after 250 reads |
Decoded once, then read
The other way to keep a jalapenojson document is to decode it once, as JSON is parsed once, and keep its rows. Here decode() runs once, before the clock starts, and every run reads its rows with the code that reads JSON's above. The first line is each parse alone, the same as reading every value in the first table. The last column says after how many reads JSON's total comes out the smaller, or never, where the reads are about the same or quicker. Its rows are dicts, as json.loads's are, with each date as a date where JSON's is text.
| 50,000 rows, decoded once | data | JSON | jalapenojson | difference | JSON catches up |
|---|
| parse it | repetitive | 77.7 ms | 45.0 ms | 1.7x faster | |
| high-entropy | 73.3 ms | 61.9 ms | 1.2x faster | |
| then read every value, as columns | repetitive | 14.6 ms | 13.0 ms | 1.1x faster | never |
| high-entropy | 17.1 ms | 13.7 ms | 1.2x faster | never |
| then read one number column | repetitive | 3.29 ms | 1.45 ms | 2.3x faster | never |
| high-entropy | 2.50 ms | 1.49 ms | 1.7x faster | never |
| then read one text column | repetitive | 2.48 ms | 1.50 ms | 1.7x faster | never |
| high-entropy | 2.25 ms | 1.49 ms | 1.5x faster | never |
| then read one row | repetitive | 0.00021 ms | 0.00021 ms | about the same | never |
| high-entropy | 0.00021 ms | 0.00021 ms | about the same | never |
| 1,000 rows, decoded once | data | JSON | jalapenojson | difference | JSON catches up |
|---|
| parse it | repetitive | 1.14 ms | 0.717 ms | 1.6x faster | |
| high-entropy | 1.05 ms | 0.837 ms | 1.3x faster | |
| then read every value, as columns | repetitive | 0.187 ms | 0.189 ms | about the same | never |
| high-entropy | 0.188 ms | 0.189 ms | about the same | never |
| then read one number column | repetitive | 0.030 ms | 0.027 ms | 1.1x faster | never |
| high-entropy | 0.028 ms | 0.028 ms | about the same | never |
| then read one text column | repetitive | 0.028 ms | 0.027 ms | about the same | never |
| high-entropy | 0.027 ms | 0.027 ms | about the same | never |
| then read one row | repetitive | 0.00021 ms | 0.00021 ms | about the same | never |
| high-entropy | 0.00021 ms | 0.00021 ms | about the same | never |
1,000 rows
| 1,000 rows | data | JSON | jalapenojson | difference |
|---|
| read every value | repetitive | 1.14 ms | 0.717 ms | 1.6x faster |
| high-entropy | 1.05 ms | 0.837 ms | 1.3x faster |
| read every value, as columns | repetitive | 1.36 ms | 0.426 ms | 3.2x faster |
| high-entropy | 1.29 ms | 0.537 ms | 2.4x faster |
| read one number column | repetitive | 1.17 ms | 0.041 ms | 29x faster |
| high-entropy | 1.08 ms | 0.040 ms | 27x faster |
| read one text column | repetitive | 1.17 ms | 0.120 ms | 9.7x faster |
| high-entropy | 1.07 ms | 0.109 ms | 9.8x faster |
| read one row | repetitive | 1.13 ms | 0.033 ms | 35x faster |
| high-entropy | 1.04 ms | 0.032 ms | 32x faster |
| write every value | repetitive | 1.20 ms | 0.663 ms | 1.8x faster |
| high-entropy | 1.27 ms | 0.708 ms | 1.8x faster |
C
cJSON, the library most C code uses, and yyjson, one of the fastest JSON parsers there is, against jj_parse() and the accessors. Each run parses and then reads what the task asks for. The JSON parsers hand back a number as a double and text as a pointer and a length, and a date is text to them. jalapenojson finds each value with jj_field(), by arithmetic, and reads it with the accessor for its type: jj_int() for an integer, which has nothing to check; jj_float_checked() for a float, which refuses a NaN or an infinity; jj_str_checked() for text, which checks that it is UTF-8, as yyjson does while it parses, and leaves it as a pointer and a length; and jj_date_d() for a date, which checks its range and hands back its year, month and day. There is no C encoder, so there is no write task.
| 50,000 rows | data | cJSON | yyjson | jalapenojson | vs cJSON | vs yyjson |
|---|
| read every value | repetitive | 58.1 ms | 8.63 ms | 3.67 ms | 16x faster | 2.4x faster |
| high-entropy | 61.3 ms | 9.56 ms | 5.06 ms | 12x faster | 1.9x faster |
| read one number column | repetitive | 59.5 ms | 7.95 ms | 0.150 ms | 397x faster | 53x faster |
| high-entropy | 62.5 ms | 8.74 ms | 0.150 ms | 417x faster | 58x faster |
| read one text column | repetitive | 60.6 ms | 7.91 ms | 1.10 ms | 55x faster | 7.2x faster |
| high-entropy | 58.2 ms | 9.60 ms | 1.17 ms | 50x faster | 8.2x faster |
| read one row | repetitive | 57.2 ms | 7.07 ms | 0.00035 ms | 164,394x faster | 20,318x faster |
| high-entropy | 62.0 ms | 8.63 ms | 0.00036 ms | 173,645x faster | 24,187x faster |
Parsed once, then read
Every table above times the parse with the reading, which is what reading a document once costs. A process that keeps a document and reads it many times pays for the parse once and then for the reading alone, so here the parse runs once, before the clock starts, and every run reads from what it made. Every run reads with the accessors above, so jalapenojson still checks each value as it reads it, where cJSON and yyjson checked theirs while they parsed. Neither keeps an index of an array's values, so finding the middle row walks half of the rows, parsed or not. The first line is the parse alone. The last two columns say, for cJSON and for yyjson, after how many reads JSON's total, its parse and then its reads, comes out the smaller, or never, where jalapenojson's reads are the quicker too.
| 50,000 rows, parsed once | data | cJSON | yyjson | jalapenojson | vs cJSON | vs yyjson | cJSON catches up | yyjson catches up |
|---|
| parse it | repetitive | 50.2 ms | 7.31 ms | 0.00029 ms | 170,686x faster | 24,857x faster | | |
| high-entropy | 52.4 ms | 7.96 ms | 0.00030 ms | 177,613x faster | 26,970x faster | | |
| then read every value | repetitive | 6.75 ms | 1.09 ms | 3.67 ms | 1.8x faster | 3.4x slower | never | after 3 reads |
| high-entropy | 6.70 ms | 0.897 ms | 5.09 ms | 1.3x faster | 5.7x slower | never | after 2 reads |
| then read one number column | repetitive | 5.70 ms | 0.634 ms | 0.150 ms | 38x faster | 4.2x faster | never | never |
| high-entropy | 6.13 ms | 0.576 ms | 0.150 ms | 41x faster | 3.9x faster | never | never |
| then read one text column | repetitive | 4.32 ms | 0.562 ms | 1.10 ms | 3.9x faster | 2.0x slower | never | after 14 reads |
| high-entropy | 4.37 ms | 0.601 ms | 1.17 ms | 3.7x faster | 1.9x slower | never | after 15 reads |
| then read one row | repetitive | 1.36 ms | 0.254 ms | 0.000052 ms | 26,138x faster | 4,880x faster | never | never |
| high-entropy | 1.38 ms | 0.256 ms | 0.000059 ms | 23,458x faster | 4,346x faster | never | never |
| 1,000 rows, parsed once | data | cJSON | yyjson | jalapenojson | vs cJSON | vs yyjson | cJSON catches up | yyjson catches up |
|---|
| parse it | repetitive | 0.627 ms | 0.097 ms | 0.00029 ms | 2,163x faster | 334x faster | | |
| high-entropy | 0.662 ms | 0.106 ms | 0.00029 ms | 2,274x faster | 363x faster | | |
| then read every value | repetitive | 0.024 ms | 0.020 ms | 0.070 ms | 2.9x slower | 3.4x slower | after 14 reads | after 2 reads |
| high-entropy | 0.027 ms | 0.017 ms | 0.090 ms | 3.4x slower | 5.3x slower | after 11 reads | after 2 reads |
| then read one number column | repetitive | 0.021 ms | 0.0085 ms | 0.0030 ms | 7.1x faster | 2.8x faster | never | never |
| high-entropy | 0.021 ms | 0.0072 ms | 0.0030 ms | 6.9x faster | 2.4x faster | never | never |
| then read one text column | repetitive | 0.015 ms | 0.0059 ms | 0.015 ms | about the same | 2.5x slower | never | after 11 reads |
| high-entropy | 0.015 ms | 0.0059 ms | 0.018 ms | 1.2x slower | 3.0x slower | after 240 reads | after 9 reads |
| then read one row | repetitive | 0.0054 ms | 0.00092 ms | 0.000055 ms | 97x faster | 17x faster | never | never |
| high-entropy | 0.0053 ms | 0.00092 ms | 0.000068 ms | 78x faster | 14x faster | never | never |
1,000 rows
| 1,000 rows | data | cJSON | yyjson | jalapenojson | vs cJSON | vs yyjson |
|---|
| read every value | repetitive | 0.659 ms | 0.118 ms | 0.070 ms | 9.4x faster | 1.7x faster |
| high-entropy | 0.694 ms | 0.123 ms | 0.090 ms | 7.8x faster | 1.4x faster |
| read one number column | repetitive | 0.648 ms | 0.106 ms | 0.0033 ms | 198x faster | 32x faster |
| high-entropy | 0.689 ms | 0.112 ms | 0.0033 ms | 210x faster | 34x faster |
| read one text column | repetitive | 0.639 ms | 0.102 ms | 0.015 ms | 42x faster | 6.7x faster |
| high-entropy | 0.683 ms | 0.111 ms | 0.018 ms | 39x faster | 6.3x faster |
| read one row | repetitive | 0.632 ms | 0.098 ms | 0.00035 ms | 1,816x faster | 281x faster |
| high-entropy | 0.670 ms | 0.106 ms | 0.00036 ms | 1,841x faster | 292x faster |
WebAssembly
The WebAssembly sections were not measured for this version, because the machine that ran the benchmark has clang 18.1.3 and wasm-ld, but not wasi-libc or compiler-rt's wasm32 builtins, which the two WebAssembly modules are built against, so neither could be built. bench/wasm.c, the C reader's calls for JavaScript, was compiled for the machine all the same, to check that it still builds against c/jalapenojson.h, but it was not run. The WebAssembly numbers published for format 0.6 measured a reader of a format since replaced, so they are not carried over.
How it was measured
- Each number comes from its own process, started for that one measurement, so no reader runs in a process another reader has warmed.
- Warmed up means the task ran until it had run for 200 ms, and then the fastest of at least 15 more runs and at least 500 ms was kept. The number shown is the median of that over 5 rounds, each of which ran every measurement once, in a different order.
- Parsed once, and decoded once, mean the parse ran once, before the clock started, and every timed run read from what it made. Such a read can take a few nanoseconds, less than reading the clock does, so those runs are timed in batches of as many as take 0.1 ms, and a run's time is its batch's divided by how many it held. In C the compiler is told between reads that memory may have changed, so that each one reads the document again. Where a table says when JSON catches up, that is worked out from the table's own numbers.
- Every run's result is checked: a count of the values it read, their sum, and a CRC-32 of their text, against the same worked out from the rows the files were written from. A run that read something else stops the benchmark.
- The input is bytes in memory for both formats. Freeing memory is not timed in C; in JavaScript and Python the garbage collector runs when it runs.
- jalapenojson checks every date it reads, in every language. JavaScript gets its canonical text, such as
2025-03-04, Python a date object, and C its year, month and day from jj_date_d(). JSON has no dates, so its readers hand the same values back as unchecked strings. The checksum counts every date as its canonical text, spelled out after the clock stops from what each reader handed back.