minhajuddin
https://github.com/minhajuddin/benchmark-large-json-parsing
Benchmark large json parsing
A few crude benchmarks for Elixir, Golang and Ruby
Processor Intel(R) Core(TM) i7-5820K CPU @ 3.30GHz
OS: Ubuntu 16.04
10mb.json
Golang [jq]
$ time jq '.' data/10mb.json > /dev/null
real 0m0.567s
user 0m0.551s
sys 0m0.016s
Elixir
Time taken [Poison]: 1218.831ms
Time taken [Jason]: 508.461ms
Ruby
time ruby app.rb
real 0m0.220s
user 0m0.203s
sys 0m0.017s
100mb.json (sf-city-lots-json/citylots.json at master · zemirco/sf-city-lots-json · GitHub)
Golang [jq]
$ time jq '.' data/citylots.json > /dev/null
real 0m14.436s
user 0m13.992s
sys 0m0.420s
Elixir
Time taken [Poison]: 32_640.87ms
Time taken [Jason]: 11_602.128ms
Ruby
$ time ruby app.rb
real 0m4.738s
user 0m4.498s
sys 0m0.240s
Trending in Discussions
Hey there,
It’s been more than a year since we started using LiveView as our main UI library and building a whole library of UI componen...
New
I am happy to introduce the very α version of the new programming language compiled to BEAM.
Welcome Cure.
It has literally three kille...
New
A little off-topic, but I feel like people here have a good head on their shoulders.
I used to be quite good at making software. Was luc...
New
Hi there! :wave:
@frigidcode and I (but mostly him) have been running an Elixir Book club, we’re almost done with Designing Elixir Syste...
New
I’ve been using Emacs as my main code editor for more than a two years. It’s a custom build version although I’ve tried doom emacs and sp...
New
I love Elixir. It’s one of 2 programming languages I’ve ever fallen in love with.
But I don’t use it anymore.
Serverless was the promis...
New
Lately I’ve been thinking about how to organize components as a LiveView application grows. One of the pain points I’ve found (for myself...
New
Other Trending Topics
Edit: 2026 May 15 - This post is archived.
Mob is alive!!
Main docs: mob v0.7.11 — Documentation
A bit of explanation for the slightly c...
New
Hobbes is a low-level distributed database for the Elixir programming language.
Hobbes provides a simple, safe, and scalable storage lay...
New
Hey. Is there anyone here who creates agents in their apps? Not talking about using agents, but creating them. I’m finding it pretty diff...
New
ExRatatui lets you cook up rich terminal UIs in Elixir, powered by Rust’s ratatui via Rustler NIFs. Build interactive terminal applicatio...
New
With AI doing more of the implementation work, I’ve been wondering how much coding I should deliberately keep doing myself.
My main conc...
New
Just published claude-code-elixir, a plugin marketplace for Claude Code with Elixir support. These are the plugins I’ve been using for my...
New
Categories:
Sub Categories:
Forums
Popular Tags
- #ecto
- #liveview
- #troubleshooting
- #learning-elixir
- #library
- #deployment
- #erlang
- #testing
- #genserver
- #mix
- #absinthe
- #remote-other
- #otp
- #plug
- #how-to-question
- #macros
- #postgres
- #elixirconf
- #channels
- #exunit
- #discussion
- #code-sync
- #podcasts
- #javascript
- #onsite
- #dialyzer
- #docker
- #authentication
- #umbrella
- #full-time-contract
- #podcasts-by-brainlid
- #ai
- #ecto-query
- #elixirconf-us
- #blog-post
- #elixir-ls
- #phoenix_html
- #iex
- #graphql
- #genstage
- #websockets
- #supervisor
- #advent-of-code
- #distillery
- #processes
- #elixirconf-eu
- #api
- #forms
- #metaprogramming
- #hex










Showing Posts 1 to 10- Show Best Posts
- Show All (oldest first)
- Show All (newest first)
amnu3387
Does this mean Ruby San, is the fastests fasters ?
(btw shouldn’t this be done with benchee or so?)
brightball
Seems about right. Would be nice to have Jiffy in there as well just for comparison sake.
One important thing to consider when looking at those numbers: the Go and Elixir solutions are written in pure Go and pure Elixir respectively.
I don’t know what they’re using on the Ruby side but most efficient code in Ruby/Python/PHP/Perl is just directly calling C.
michalmuskala
The Ruby parser is implemented in C, so it’s more like comparing C to Elixir. Obviously C is going to be faster
We’re not doing that bad actually. It would be interesting to compare with Jason compiled with HiPE. In my benchmarks this makes it at least twice as fast.
The data is also quite different from what you’d face in a regular HTTP app - the JSON is pretty-printed, most JSON flying on the wire is not. This can have significant difference in the actual performance. Depending on what you want to learn from this, it can be important.
Shikada
There’s exactly 0 chance that Ruby is not just calling some C lib for this
Still, for native Elixir this is reassuringly fast.
brightball
Don’t suppose you’d be up for tweaking the Techempower benchmarks for Elixir to use Jason with HiPE. It’s the basis for the results of so much of those tests I think it would go a long way with the report.
OvermindDL1
Let’s have some fun, here is how they compare to C++/rapidjson:
Admittedly this benchmark is flawed because
jqis outputting to stdout and elixir/ruby/C++ are just kind of blackholing the data after it is parsed, so jq/go is artificially limited here. In addition the elixir version is actually instancing a tree to hold the whole structure, which is wasted work as well (unsure about ruby). The C++ version is fully parsing and performing callbacks for every parse (standard sax parsing).I can PR the C++ one in it if you want, it only needs the normal C++ compiler and cmake installed, nothing else needed (not even rapidjson, it acquires it itself).
OvermindDL1
Just to make sure, here is the C++ version as both a sax parser, and as an elixir-style-structure-building document parser (yay eating memory):
Not much of a difference, honestly the C++ compiler is so good that it is probably being optimized out, hmm…
EDIT: And I added some code to print out some details about the structure to ensure it is compiled and parsed in full and it somehow got a few milliseconds faster… so yeah those are accurate, C++ is just fast as always…
minhajuddin
Would love a PR
minhajuddin
You are right about jq doing more work, I’ll use the standard json parser and make it match the ruby and elixir versions.
Not sure you mean by this:
Elixir would parse the data and have it in memory.
The C++ version seems insane, I’d love to add a Rust benchmark too. I know this is all crude benchmarking but it gives you a sense of comparison.
minhajuddin
I didn’t use Benchee because the run times are fairly large. I’ll see if I can add benchee with small json loads.