HackerReposA FIELD GUIDE TO OPEN SOURCE
ProSponsor the shelf♧ 0
← Back to top all-time
chadaustin
sajson
C++2014–2019
chadaustin / sajson

sajson

Lightweight, extremely high-performance JSON parser for C++11

3Distinct people
4Mentions
0Explicit recommenders
574GitHub stars
REPOSITORY AT A GLANCE

What to know before exploring

What it is

Lightweight, extremely high-performance JSON parser for C++11

GitHub

Where it is used

No documented product use has been verified yet.

What people are saying

No recommendation phrase was found in the indexed comments.

No classified warning is attached to this page. Read the discussions before treating silence as approval.

Also in these discussions

No other repository is repeatedly linked in the same discussions.

This week on Hacker News

Nov 7–Nov 14 UTC · Direct repository links and separately labeled related project stories. Indexed through 11/14/2026, 3:56:07 PM UTC.

No direct repository links were found in the indexed HN discussions over the past seven days. Older discussions are available below.

Mentions over time

HN mentions by year4 dated mentions

Observed mentions: 2014-11-14 20:24:12 UTC to 2019-02-21 15:14:28 UTC.

0122014-01-01 00:00:00 UTC to 2015-01-01 00:00:00 UTC (exclusive): 1 mentions; 0 submissions, 1 comments20142015-01-01 00:00:00 UTC to 2016-01-01 00:00:00 UTC (exclusive): 0 mentions; 0 submissions, 0 comments2016-01-01 00:00:00 UTC to 2017-01-01 00:00:00 UTC (exclusive): 0 mentions; 0 submissions, 0 comments20162017-01-01 00:00:00 UTC to 2018-01-01 00:00:00 UTC (exclusive): 2 mentions; 0 submissions, 2 comments2018-01-01 00:00:00 UTC to 2019-01-01 00:00:00 UTC (exclusive): 0 mentions; 0 submissions, 0 comments2019-01-01 00:00:00 UTC to 2020-01-01 00:00:00 UTC (exclusive): 1 mentions; 0 submissions, 1 comments2019

Counts come from the repository’s dated source evidence. Index cutoff: 2026-11-02 08:16:59 UTC.

View mention counts and date ranges
UTC ranges include their start and exclude their end. Select a period to filter the source evidence.
PeriodStart (UTC)End (exclusive, UTC)MentionsSubmissionsComments
20142014-01-01 00:00:00 UTC2015-01-01 00:00:00 UTC101
20152015-01-01 00:00:00 UTC2016-01-01 00:00:00 UTC000
20162016-01-01 00:00:00 UTC2017-01-01 00:00:00 UTC000
20172017-01-01 00:00:00 UTC2018-01-01 00:00:00 UTC202
20182018-01-01 00:00:00 UTC2019-01-01 00:00:00 UTC000
20192019-01-01 00:00:00 UTC2020-01-01 00:00:00 UTC101

What Hacker News says

4 sources
Hi all, author here. Several people have raised questions about SIMD. For many workloads, SIMD is obviously a huge win. But in my experience, for problems like this, the gains are marginal and the additional complexity often isn't worth it. e.g. Do you have a build-time option? Check at runtime at every call? Use templates to check at startup and run a different code path? That said, it never hurts to try, so I implemented the fast string path in AVX2 (see https://github.com/chadaustin/sajson/commit/e87da27883ffe0a3...). It actually benchmarks slower than the scalar code: https://gist.github.com/chadaustin/6fe8d250ac8402ad70a724e7a... I couldn't tell you why - it's possible something could be tweaked to make it actually execute faster, or that enabling -mavx2 causes other code to get slower, but I wanted to illustrate that enabling SI
Read the rest
MD is not always an automatic go fast button. I did look at the instructions generated and they seem reasonable: .LBB5_118: vmovdqu ymm5, ymmword ptr [rbx - 32] vpcmpgtb ymm6, ymm5, ymm0 vpcmpeqb ymm7, ymm5, ymm1 vpcmpeqb ymm8, ymm5, ymm2 vpcmpeqb ymm5, ymm5, ymm3 vpxor ymm5, ymm5, ymm4 vpor ymm6, ymm8, ymm6 vpor ymm5, ymm5, ymm6 vpor ymm5, ymm5, ymm7 vpmovmskb esi, ymm5 test esi, esi jne .LBB5_148 mov rbp, rax sub rbp, rbx mov rsi, rbx lea rbx, [rbx + 32] cmp rbp, 31 jg .LBB5_118 jmp .LBB5_120 .LBB5_148: add rbx, -32 bsr eax, esi xor eax, 31 lea rsi, [rbx + rax] mov bl, byte ptr [rbx + rax] .LBB5_125: mov r10, qword ptr [rsp + 24] # 8-byte Reload mov r9b, byte ptr [rsp + 39] # 1-byte Reload sub rcx, r8 movzx eax, bl cmp eax, 34 jne .LBB5_127 I suppose it's also worth pointing out that, while string scanning is an important part of JSON parsing, the instruction histogram is generally spread across the entire parser. That is, a doubling in string parsing performance would only help overall parse times by 10-20% maybe. Edit: Upon thinking about it, it's probably slower because there's a dependency chain through a pile of high-latency vector instructions all the way to the bsr (should be bsf, I fixed on the branch) to the next loop iteration's load. The branch predictor doesn't have much opportunity to help us out here. You could look at Agner Fog's tables and calculate the critical path latency of this loop, but I'm guessing it's not pretty.
In Writing a Fast JSON Parser

MAKE YOURSELF AT HOME

A few shortcuts

/
Search the collection
?
Open this guide
Esc
Close dialogs and navigation

Your saved repositories and interests stay in this browser.