TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

A Journey building a fast JSON parser and full JSONPath, Oj for Go

111 pointsby dcualmost 5 years ago

6 comments

quelsolaaralmost 5 years ago
I wrote a fast C json parser a few years ago (+600megs/s) And it was an interesting experience. Validating the json roughly halved the performance. The most interesting performance gain was going from using aligned structs to packed byte offsets being accessed using memcpy. It added 20-30%. The overhead of aligning was nothing compared to fewer cache misses. In the end i found that making a truly fast json parser mostly depend on what you parse it to. Like, is the structure read only, and how fast is it to access?
评论 #23740702 未加载
jeffbeealmost 5 years ago
There is a nugget buried at the bottom of this: you will get different output for different kinds of for ... range or for i ... loops. You&#x27;d think these are equivalent:<p><pre><code> for i = range arr { sum += arr[i] } for _, c = range arr { sum += c } </code></pre> ... but the latter is 4 bytes shorter in x86. The compiler takes things literally.
评论 #23740560 未加载
svnpennalmost 5 years ago
&gt; Both the Ruby Oj and the C parser OjC are the best performers in their respective languages.<p>Um, no, they arent:<p><a href="https:&#x2F;&#x2F;github.com&#x2F;simdjson&#x2F;simdjson" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;simdjson&#x2F;simdjson</a>
评论 #23738397 未加载
throwaway77384almost 5 years ago
How does this compare to something like <a href="https:&#x2F;&#x2F;github.com&#x2F;valyala&#x2F;fastjson" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;valyala&#x2F;fastjson</a> ?
评论 #23742179 未加载
nautilus12almost 5 years ago
I wonder how people that make super specific things like this their whole career make money. I wonder if they are independently wealthy and just do things like this for fun
评论 #23742548 未加载
评论 #23742206 未加载
remorsesalmost 5 years ago
Go is becoming the language to implement json parsers
评论 #23739200 未加载