GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — 1 line fix + benchmark: stop resetting class cache for each document by Philosobyte · Pull Request #78 · simdjson/simdjson-java

Conversation

@Philosobyte

@Philosobyte Philosobyte commented Apr 19, 2026

Copy link
Copy Markdown

Every time we parse a document, we enter method SchemaBasedJsonIterator.walkDocument. Every time we enter said method, we call classResolver.reset();. This clears the class cache and defeats its purpose.

I benchmarked by reading twitter.json into memory, splitting it into 100 individual messages (around ~6kB each), and having each iteration read the 100 messages individually.

We are far slower than Jackson:

Benchmark                           Mode   Cnt   Score   Error  Units
SchemaBasedParseBenchmark.jackson     ss  5000   0.700 ± 0.009  ms/op
SchemaBasedParseBenchmark.simdjson    ss  5000  14.051 ± 0.017  ms/op

I removed classResolver.reset() and benchmarked again:

Benchmark                           Mode   Cnt  Score   Error  Units
SchemaBasedParseBenchmark.jackson     ss  5000  0.706 ± 0.008  ms/op
SchemaBasedParseBenchmark.simdjson    ss  5000  0.327 ± 0.006  ms/op

We are now faster than Jackson.

Any reason this classResolver.reset() call needs to exist?

Here is my command so you can reproduce my results:

java --add-modules=jdk.incubator.vector -jar .\build\libs\simdjson-java-0.4.1-stop-clearing-class-cache-for-each-doc-SNAPSHOT-jmh.jar -wi 200 -i 1000 -tu ms -t 1 SchemaBasedParseBenchmark

I also needed to update version of jsoniterScalaVersion, or else I would get build errors.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Philosobyte added 2 commits April 18, 2026 22:47
@Philosobyte
stop clearing class cache for each doc
b2dd022
@Philosobyte
add benchmark for small schema-based parsing
7607d0f
@Philosobyte

Philosobyte commented Apr 19, 2026

Copy link
Copy Markdown
Author

@piotrrzysko I would appreciate if you could look at this 1 line fix (plus benchmark).

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

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

Reviewers

No reviews

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

1 participant

@Philosobyte
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.