-
-
Notifications
You must be signed in to change notification settings - Fork 589
Add Benchmarks & Split/Unroll-scopes optimizations (x1.6 faster) #182
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
Conversation
* Improve statistics print-outs. * Engrave timming results in benchmark docstrings.
…ing into a list whe not null (instead of using a context-manager each time) Roughly x 1.5 faster
…g by keeping fragments separated from URL (and avoid redunant frag/defrag).
…ization-branches. * FIX 2 forgotten test-case on resolver-URIs from split_scopes. x 1.8 faster in big referenced model.
…s_stack empty when iteration breaks (no detectable performance penalty). * Replace non-python-2.6 DefragResult with named-tuple. * Add test-case checking scopes_stack empty.
…e with hand-made stats-funcs.
4eba788
to
f0c6f8f
Compare
Hey -- thanks a lot, I haven't obviously gotten a chance to really read through most of this yet, but thanks for tackling this. The one thing I notice so far is that the tests and methods ( For the benchmarks, what we'll have to do is basically baseline each machine (there are some tools to do that or we can do it manually) in order for the performance numbers to scale to wherever you run the tests, but it looks like you've definitely got a good start there. I'll have a read through but it'll probably be a few days, but definitely thanks for working on this. |
Neglibly slower, BUT reduced stdev and simpler main-loop code.
This changes improve the performance on my benchmark by nearly 2x. What can I do to help get this merged? It looks like the tests are failing and it needs to be rebased with msater. |
ddbc519
to
f0c6f8f
Compare
@Julian Would it be possible for you to take a look at this branch? Our project has a relatively simple schema, and validation using jsonschema is frequently the slowest part of our code. A performance increase of 2x would be a significant benefit to us. As @dnephin mentioned, what can I do to help get this merged in? |
Hi @cgurnik -- @dnephin already successfully managed to get in some performance changes -- can you give your project a shot on current master and see if you get any difference? I'm trying to find some time to do a release but I was overseas for a few days. If you don't see results can you possibly include some profiling output, would love to have a look! |
Most of the changes from this branch were included in my branch, so it might even be appropriate to close this one. |
@dnephin Do you mean that this dnephin/jsonschema@1c15827 (branch: |
Right, I included many of them in dnephin@2fda155 |
For issue #158:
benchmark
branch: Added a benchmark with meta_schemas cheking & extensive sample-schema with references.2.a.
split_scopes
branch: Keep URIs in 2 parts (url, fragment) to avoid fragging/defragging since fragments do not join, they always override (~1.1 faster)2.b.
unroll_scopes
branch: Replace resolver.in_scope() context-manager with a push/pop stack of scopes, that does nothing it when noid
property exists (~1.5 faster).split_unroll_scopes
branch: Combined both optimizations (~1.6 faster).wltp/test/test_benchmarks.py
TC (unfortunately they are host-specific).ALL TCs RUN AS OK (apart from split_frags which was post-edited on the combined branch)