Skip to content

Comments

Use json-iterator/go for all JSON operations#556

Merged
boyter merged 1 commit intoboyter:masterfrom
apocelipes:using-jsoniter
Nov 11, 2024
Merged

Use json-iterator/go for all JSON operations#556
boyter merged 1 commit intoboyter:masterfrom
apocelipes:using-jsoniter

Conversation

@apocelipes
Copy link
Contributor

Currently, we have two JSON libraries in the code base: "encoding/json" and "github.com/json-iterator/go". Use one of them is completely enough.

The "json-iterator/go" is faster than the stdlib and uses less memory. So we choose the fast one for all JSON operations.

It also reduces the binary file size. For an example on Linux AMD64 with Go1.22.7, the binary file change is 8988568 -> 8811060 bytes, more than 150 kib was reduced.

@boytertesting boytertesting bot added M/complexity Normal or medium complexity XL/size Extra large change labels Nov 6, 2024
@apocelipes apocelipes changed the title Using jsoniter for all JSON operations Use json-iterator/go for all JSON operations Nov 11, 2024
@boytertesting boytertesting bot added M/complexity Normal or medium complexity M/size Normal or medium sized change and removed M/complexity Normal or medium complexity XL/size Extra large change labels Nov 11, 2024
@boyter
Copy link
Owner

boyter commented Nov 11, 2024

Reduction of the binary size is the main reason I like this. The reason I removed it was due to the speed being negligible for everything I tried.

@boyter boyter merged commit 0ff481e into boyter:master Nov 11, 2024
@apocelipes apocelipes deleted the using-jsoniter branch November 12, 2024 06:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

M/complexity Normal or medium complexity M/size Normal or medium sized change

Projects

Status: DONE

Development

Successfully merging this pull request may close these issues.

2 participants