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

Adds benchmark tests for Schematics tool #2381

Merged
merged 4 commits into from
Feb 25, 2021

Conversation

AlvaroLQueiroz
Copy link
Contributor

Change Summary

This PR adds a comparison tests for the Schematic tool.

@codecov
Copy link

codecov bot commented Feb 20, 2021

Codecov Report

Merging #2381 (5bf98ca) into master (b7a8ef2) will decrease coverage by 0.09%.
The diff coverage is n/a.

@@             Coverage Diff             @@
##            master    #2381      +/-   ##
===========================================
- Coverage   100.00%   99.90%   -0.10%     
===========================================
  Files           23       25       +2     
  Lines         4485     5072     +587     
  Branches       909     1038     +129     
===========================================
+ Hits          4485     5067     +582     
- Misses           0        1       +1     
- Partials         0        4       +4     
Impacted Files Coverage Δ
pydantic/json.py 100.00% <0.00%> (ø)
pydantic/mypy.py 100.00% <0.00%> (ø)
pydantic/types.py 100.00% <0.00%> (ø)
pydantic/utils.py 100.00% <0.00%> (ø)
pydantic/fields.py 100.00% <0.00%> (ø)
pydantic/typing.py 100.00% <0.00%> (ø)
pydantic/_hypothesis_plugin.py 100.00% <0.00%> (ø)
pydantic/main.py 99.06% <0.00%> (ø)
pydantic/__init__.py 100.00% <0.00%> (ø)

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 b7a8ef2...5bf98ca. Read the comment docs.

@samuelcolvin
Copy link
Member

Normally I refuse new benchmarks, but I do see that this library is relatively popular.

Could you give a summary of the benchmark results with this added? I'm afraid I don't have a linux machine at hand right now.

try:
obj = self.model(data)
return True, obj.validate()
except Exception as e:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

surely not all exceptions should be caught here?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You're right. I've already corrected.

@AlvaroLQueiroz
Copy link
Contributor Author

@samuelcolvin i don't have a linux machine too. But this is the results executed on a Mac Pro with MacOS Catalina, i5 2GHZ, 16GB.

Package Version Relative Performance Mean validation time
pydantic 1.7.3 91.8μs
attrs + cattrs 20.3.0 1.3x slower 116.6μs
valideer 0.4.2 1.3x slower 122.0μs
marshmallow 3.10.0 2.5x slower 225.0μs
voluptuous 0.12.1 2.5x slower 226.0μs
trafaret 2.1.0 3.3x slower 305.0μs
schematics 2.1.0 10.3x slower 948.6μs
django-rest-framework 3.12.2 12.6x slower 1154.3μs
cerberus 1.3.2 22.6x slower 2073.4μs

@samuelcolvin samuelcolvin merged commit f32832a into pydantic:master Feb 25, 2021
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.

None yet

2 participants