Skip to content
프로젝트

소개

High performance JSON decoder in Go

개발 도구

이 수치를 측정하는 방법

What you can do

  • Fully compatible with the Go standard library, Both the encoder and the decoder passed all tests from it.
  • Efficient. Uses less memory and several times shorter decoding time when I benchmark this against the standard library.
  • "encoding/json" independent. Unlike some of other implementations, It doesn't call the standard library's JSON, at all. it's written from ground up.

측정된 스타 증가

in 24h
0
in 7 days
0
in 15 days
-1
in 1 month
기록 수집 중

서로 겹치는 기간의 순증가량이며 일별 합계가 아닙니다. 측정값이 없으면 비워 둡니다. 스타는 관심도를 나타내며 품질을 보장하지 않습니다.

README.md

Original

Sonnet

High performance JSON library in Go.

gopher.png

Features

  • Fully compatible with the Go standard library, Both the encoder and the decoder passed all tests from it.

  • Efficient. Uses less memory and several times shorter decoding time when I benchmark this against the standard library.

  • "encoding/json" independent. Unlike some of other implementations, It doesn't call the standard library's JSON, at all. it's written from ground up.

The problems of others

Some are CPU dependent, some libraries' APIs are incompatible, most of them use unsafe, some requires static code generation, etc.

But that's not all. even with these downsides, they're still slow.

Installation

go get github.com/sugawarayuuta/sonnet

Usage

The usage is the same as the standard library.

Use pkg.go.dev website, or read the blog post

Performance differences after the removal of unsafe

After some effort, it's actually faster than the previous one. See the below benchmarks for more information.

Marshal Unmarshal
marshal.png unmarshal.png

Benchmarks

Although I recommend you to benchmark this yourself, here is benchmarks on my machine for reference. (currently, it's showing the old version. It'll be updated to the latest version of this, soon)

In short, At least in my environment, I couldn't find a faster library that is implemented "correctly". "correct", as in, proper UTF8 handling, validation of RawMessage, and others. Which some of the alternatives don't do.

Thank you

관련 프로젝트 살펴보기

불러오는 중…