Skip to content

Improve performance for large JSON files using json-iterator#110

Merged
simeji merged 1 commit into
masterfrom
feature/performance-large-json
Apr 5, 2026
Merged

Improve performance for large JSON files using json-iterator#110
simeji merged 1 commit into
masterfrom
feature/performance-large-json

Conversation

@simeji

@simeji simeji commented Apr 5, 2026

Copy link
Copy Markdown
Owner

Summary

  • Replace encoding/json.MarshalIndent in the hot path (GetPretty/Get) with json-iterator/go
  • Results in ~30% faster JSON encoding, improving responsiveness when working with large JSON files (e.g. 16MB+)
  • No behavioral changes — json-iterator is fully compatible with the standard library

Benchmark

Tested on Apple M1 with a ~625KB JSON (~50,000 entries):

Before After
GetPretty() per call 8.5ms 6.0ms

For a 16MB file, this reduces per-keypress processing time from ~220ms to ~140ms.

Test plan

  • go test ./... passes
  • Behavior unchanged for small and large JSON inputs
  • Noticeably faster with large JSON files

Replace encoding/json.MarshalIndent in the hot path (GetPretty/Get)
with json-iterator, which is ~30% faster for marshaling large interface{}
trees. This improves responsiveness when working with large JSON files.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@simeji simeji merged commit af11d02 into master Apr 5, 2026
2 checks passed
@simeji simeji deleted the feature/performance-large-json branch April 5, 2026 01:04

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: d39661aac9

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread json_manager.go
@ofek

ofek commented Jun 5, 2026

Copy link
Copy Markdown

Heads up that the new dependency is unmaintained and the repository was archived several months before this PR.

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.

2 participants