Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cache NodeRefs in grammar_builder #70

Merged
merged 6 commits into from
Nov 26, 2024

Conversation

hudson-ai
Copy link
Collaborator

  • For the FHIR schema, all the serialization calls slow things down by about 15%, (from ~140ms to build the whole grammar to ~160ms)
  • For the FHIR schema, this decreases the size of the compiled grammar by about 30%
  • I have concerns about storing serialized grammars as keys, as this should about double the size of our GrammarBuilder struct. But this is pretty inconsequential unless we're talking huge schemas like FHIR (and I suppose 2*.7=1.4 means we're not quite doubling the size overall)

There are likely quite a few optimizations we can still do to reduce the time to build grammars, both in the JSON compiler and in repeat.

Linked to issue #58

@hudson-ai hudson-ai changed the title [WIP] Cache NodeRefs in grammar_builder Cache NodeRefs in grammar_builder Nov 26, 2024
@hudson-ai
Copy link
Collaborator Author

@mmoskal ready for review :)

@hudson-ai hudson-ai merged commit 65cbcbe into guidance-ai:main Nov 26, 2024
2 checks passed
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