add cache to get_schema, combine instance checks with validate #6
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.
Here are a few optimizations.
Combining the additional_validators with _Validate.iter_errors removes 1 walk of the tree during validation.
However, these changes don't appear to drastically speed up the test suite (it's still 63-65 seconds on my computer). This is possibly because the test files/trees are mostly small. For a random jwst asdf file I found in my downloads (jwst_nirspec_ifupost_0012.asdf) validation takes 964 ms without the changes and 599 ms with the changes in this PR.
The following tests run slowly with jsonschema 4.18:
descend
(in jsonschema, not the one in asdf.schema) whereas in 4.18descend
takes up ~2.8 seconds. line_profiler doesn't seem to play nice with the dynamic class generation and isn't providing meaningful results when I try to profile lines in descend.I think this is far as I'm going to get on this today but I'll update if I get more time to look at it (and find anything useful).