Skip to content

Cache NJsonSchema properties in JsonReferenceResolver#1817

Merged
lahma merged 1 commit into
RicoSuter:masterfrom
lahma:optimize-njsonschema-property-check
May 1, 2025
Merged

Cache NJsonSchema properties in JsonReferenceResolver#1817
lahma merged 1 commit into
RicoSuter:masterfrom
lahma:optimize-njsonschema-property-check

Conversation

@lahma

@lahma lahma commented May 1, 2025

Copy link
Copy Markdown
Collaborator

There's high reflection cost the code path usually always hits JsonSchema type.

Using my custom large (1,3MB) swagger file.

Before

Method Mean Error StdDev Gen0 Gen1 Allocated
GenerateFile 151.2 ms 2.92 ms 7.22 ms 6000.0000 3000.0000 78.63 MB

After

Method Mean Error StdDev Gen0 Gen1 Gen2 Allocated
GenerateFile 112.0 ms 2.12 ms 4.56 ms 7000.0000 3000.0000 500.0000 78.27 MB

@lahma lahma merged commit 1099d74 into RicoSuter:master May 1, 2025
2 checks passed
@lahma lahma deleted the optimize-njsonschema-property-check branch May 1, 2025 06:20
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