Mitar
Mitar’s point
Published in
May 9, 2021

I made a benchmark comparing how long it takes to decode JSON in node.js and Go. As I have noticed in the past, JSON decoding in node.js is really fast.

I used node v16.0.0 and Go v1.16. For Go, I compared both the structure of the data (providing a struct type) and not knowing it (using map[string]interface{} interface). Moreover, I compared standard encoding/json and jsoniter. I measured on a range of JSON files from 10 regular and 10 array fields (~23 KB) to 200 regular and 200 array fields (~1.3 MB). I repeated each run 10 times and averaged.

Results

Parsing JSON in node is really fast and beats Go when no structure about JSON is provided (which is how parsing in node is done). Only with information about the structure, the non-standard jsoniter library is faster.