Skip to content

Improve Download JSON Parsing Performance#74

Closed
alexanderkiel wants to merge 1 commit intomainfrom
improve-download-json-parsing-perf
Closed

Improve Download JSON Parsing Performance#74
alexanderkiel wants to merge 1 commit intomainfrom
improve-download-json-parsing-perf

Conversation

@alexanderkiel
Copy link
Member

The standard encoding/json lib is quite slow because it uses reflection. There are some third party drop-in replacements like https://github.com/json-iterator/go or https://github.com/goccy/go-json. I decided to go with https://github.com/goccy/go-json because it's actively maintained.

The speedup is about 2x. The download of 1 million cached patient resources finishes in 11 seconds compared to 25 seconds before. Other downloads of real FHIR searches or uncached resources is not faster, but the CPU usage of blazectl is about half as much.

The standard encoding/json lib is quite slow because it uses reflection.
There are some third party drop-in replacements like
https://github.com/json-iterator/go or https://github.com/goccy/go-json.
I decided to go with https://github.com/goccy/go-json because it's
actively maintained.

The speedup is about 2x. The download of 1 million cached patient
resources finishes in 11 seconds compared to 25 seconds before. Other
downloads of real FHIR searches or uncached resources is not faster,
but the CPU usage of blazectl is about half as much.
@alexanderkiel alexanderkiel self-assigned this Aug 13, 2025
@alexanderkiel alexanderkiel marked this pull request as draft August 13, 2025 07:03
@alexanderkiel
Copy link
Member Author

We shouldn't use this. See: https://github.com/go-json-experiment/jsonbench

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant