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

perf: Cache subschemas #896

Merged
merged 1 commit into from
Dec 19, 2021
Merged

perf: Cache subschemas #896

merged 1 commit into from
Dec 19, 2021

Conversation

Stranger6667
Copy link
Contributor

Continuation of #894. This patch introduces a cache for subschemas-related keywords, which reduces the number of calls to the search routine. All subschemas-related keywords are searched in one pass and then stored in a cached dict. With the OP from #893 it reduces the total number of function calls from 61512655 to 56438634 (~9%). The number of calls to the search routine is reduced 5x (from 1090000 to 218000).

I'd be happy to know what do you think :)

@codecov
Copy link

codecov bot commented Dec 18, 2021

Codecov Report

Merging #896 (68b0454) into main (02ca9fa) will increase coverage by 0.00%.
The diff coverage is 100.00%.

Impacted file tree graph

@@           Coverage Diff           @@
##             main     #896   +/-   ##
=======================================
  Coverage   98.26%   98.27%           
=======================================
  Files          20       20           
  Lines        3170     3181   +11     
  Branches      426      430    +4     
=======================================
+ Hits         3115     3126   +11     
  Misses         44       44           
  Partials       11       11           
Impacted Files Coverage Δ
jsonschema/validators.py 97.52% <100.00%> (+0.10%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 02ca9fa...68b0454. Read the comment docs.

@Julian Julian merged commit 359b33d into python-jsonschema:main Dec 19, 2021
@Julian
Copy link
Member

Julian commented Dec 19, 2021

Wonderful, thanks again, merging!

@Stranger6667 Stranger6667 deleted the dd/more-ref-cache branch December 19, 2021 22:58
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