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

Caching inner schemas #182

Closed
wants to merge 1 commit into from
Closed

Caching inner schemas #182

wants to merge 1 commit into from

Conversation

pd
Copy link
Contributor

@pd pd commented Nov 22, 2014

⚠️ 🚧 ⚠️

I've been working on using json-schema to validate all incoming JSON data for an API I'm writing; it's functional, but can be pretty slow for complex endpoints (50ms+). I did some profiling to narrow it down to hitting JSON::Schema#initialize a lot. The change in #180 helped a bit, but the core problem remains that we constantly re-create Schema instances.

I plan to add either Schema#inner_schemas['#/some/path/fragment'], or even just directly register them into JSON::Validator.schemas; the various Attribute validation classes can then fetch from that, and only create a new schema on miss.

The code in this PR adds rspec for now, only because I couldn't come up with any more reasonable means of testing this right now. I've not touched lib at all yet.

@RST-J RST-J mentioned this pull request Dec 1, 2014
4 tasks
@pd pd closed this Jan 6, 2021
@pd pd deleted the cache-inner-schemas branch January 6, 2021 14:29
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