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

fix wasteful to_python() calls checking for undefined #1580

Merged
merged 2 commits into from
Dec 12, 2024
Merged

Conversation

davidhewitt
Copy link
Contributor

Change Summary

Calling .to_object() on JSON inputs is potentially expensive and they will NEVER be PydanticUndefined, so this is potentially a massive performance win on JSON validation...

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

Copy link

codspeed-hq bot commented Dec 12, 2024

CodSpeed Performance Report

Merging #1580 will improve performances by 49.85%

Comparing dh/perf-howler (d219006) with main (730adc3)

Summary

⚡ 1 improvements
✅ 156 untouched benchmarks

Benchmarks breakdown

Benchmark main dh/perf-howler Change
test_complete_core_root_json 667.6 µs 445.5 µs +49.85%

@sydney-runkle
Copy link
Member

Looks like we got some little 1-2% perf boosts!

@davidhewitt
Copy link
Contributor Author

Haha check again 😂

@davidhewitt davidhewitt merged commit bd91c18 into main Dec 12, 2024
29 checks passed
@davidhewitt davidhewitt deleted the dh/perf-howler branch December 12, 2024 20:27
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