-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
Use __class__ attribute for 5% speed gain. #1294
Use __class__ attribute for 5% speed gain. #1294
Conversation
interesting, I couldn't get a confirmed improvement. Did you compile pydantic for the benchmarks? |
Yes, I got the same relative results after compiling (and recompiling):
|
@StephenBrown2 could you fix tests? |
f07f771
to
c34c5a3
Compare
Codecov Report
@@ Coverage Diff @@
## master #1294 +/- ##
=======================================
Coverage 99.89% 99.89%
=======================================
Files 21 21
Lines 3713 3713
Branches 731 731
=======================================
Hits 3709 3709
Misses 2 2
Partials 2 2
Continue to review full report at Codecov.
|
Tests fixed! |
I think codecov is broken, I'll try and fix that and fix coverage later. |
Coverage actually updated, no change. The only line that's not covered is still |
Change Summary
Updates https://github.com/samuelcolvin/pydantic/tree/use-class-attribute on top of current master. It isn't 2x faster, which may be why the branch hasn't been merged yet, but it is faster, about 5% on average, as demonstrated below (avg=117.592μs/iter on master vs avg=111.204μs/iter on use-class-attribute):
Related issue number
None
Checklist
changes/<pull request or issue id>-<github username>.md
file added describing change(see changes/README.md for details)