DEV Community

Anil Kumar Maurya
Anil Kumar Maurya

Posted on • Originally published at Medium on

FastJsonparser, Fastest JSON parser for Ruby

FastJsonparser is ruby wrapper for simdjson which is written in c++.

JSON is de facto standard for exchanging data between web server and browser.

If your application is parsing large JSON data then you must consider optimising it for better performance.

I came across Simdjson which claims to parse gigabytes of JSON per second, It also claims to be over 2.5x faster than other production-grade JSON parsers. I thought this is fantastic why I am not using it.

I looked for the ways to use it and came across simdjson_ruby gem . It is wrapper for simdjson c++ library but unfortunately it was not working.

I started fixing it but got stuck in configurations then I thought why not create a new gem and import all code which I need from this gem, thus FastJsonparser was born.

To verify simdjson claim that it is really fast, I did benchmarking with existing gem Oj which claims to be fastest JSON parser for Ruby

Benchmark results:

  1. Parsing 1.2 MB JSON file

Check benchmark reference here

  1. Parsing local JSON

Check benchmark reference here

Clearly FastJsonparser outperforms both Oj and ruby’s built in JSON parser

How to Use FastJsonparser

Github: https://github.com/anilmaurya/fast_jsonparser

Let’s use it in your Ruby / Ruby on Rails projects and let me know how it performs.

P.S — Thank you https://github.com/saka1 for initial code.

Heroku

Build apps, not infrastructure.

Dealing with servers, hardware, and infrastructure can take up your valuable time. Discover the benefits of Heroku, the PaaS of choice for developers since 2007.

Visit Site

Top comments (0)

Billboard image

The Next Generation Developer Platform

Coherence is the first Platform-as-a-Service you can control. Unlike "black-box" platforms that are opinionated about the infra you can deploy, Coherence is powered by CNC, the open-source IaC framework, which offers limitless customization.

Learn more