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

collapse arguments into ValidationState #886

Merged
merged 1 commit into from
Aug 15, 2023
Merged

Conversation

davidhewitt
Copy link
Contributor

Change Summary

A refactoring to pack all of (extra, definitions, recursion_guard) into a single ValidationState. Split out of #867, both for easier review and also because the other PR is possibly not merging for a while and I think this is a useful refactoring.

Related issue number

N/A

Checklist

  • Unit tests for the changes exist
  • Documentation reflects the changes where applicable
  • Pydantic tests pass with this pydantic-core (except for expected changes)
  • My PR is ready to review, please add a comment including the phrase "please review" to assign reviewers

@codspeed-hq
Copy link

codspeed-hq bot commented Aug 15, 2023

CodSpeed Performance Report

Merging #886 will degrade performances by 22.76%

Comparing dh/validation-state (ade471d) with main (0a072b0)

Summary

🔥 1 improvements
❌ 1 regressions
✅ 136 untouched benchmarks

⚠️ Please fix the performance issues or acknowledge them on CodSpeed.

Benchmarks breakdown

Benchmark main dh/validation-state Change
test_dont_raise_error 30.5 µs 39.5 µs -22.76%
🔥 test_variable_tuple 39 µs 33.9 µs +14.83%

@codecov
Copy link

codecov bot commented Aug 15, 2023

Codecov Report

Merging #886 (ade471d) into main (0a072b0) will increase coverage by 0.00%.
The diff coverage is 98.12%.

Additional details and impacted files
@@           Coverage Diff            @@
##             main     #886    +/-   ##
========================================
  Coverage   93.78%   93.79%            
========================================
  Files         104      105     +1     
  Lines       15485    15252   -233     
  Branches       25       25            
========================================
- Hits        14523    14305   -218     
+ Misses        956      941    -15     
  Partials        6        6            
Files Changed Coverage Δ
src/validators/is_subclass.rs 80.95% <ø> (ø)
src/validators/literal.rs 92.80% <ø> (ø)
src/validators/tuple.rs 94.35% <63.15%> (-0.48%) ⬇️
src/validators/definitions.rs 95.60% <94.44%> (+7.10%) ⬆️
src/validators/union.rs 87.13% <97.05%> (+1.33%) ⬆️
src/input/return_enums.rs 84.94% <100.00%> (-0.72%) ⬇️
src/validators/any.rs 100.00% <100.00%> (ø)
src/validators/arguments.rs 100.00% <100.00%> (ø)
src/validators/bool.rs 100.00% <100.00%> (ø)
src/validators/bytes.rs 91.11% <100.00%> (-0.38%) ⬇️
... and 33 more

Continue to review full report in Codecov by Sentry.

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

Copy link
Member

@adriangb adriangb left a comment

Choose a reason for hiding this comment

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

Would it make sense to flatten Extra into ValidationState?

@davidhewitt
Copy link
Contributor Author

Potentially yes, but I'd like to work out the details of that in a future PR.

@adriangb
Copy link
Member

Agreed, just clarifying, hence the ✅

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