Skip to content

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

@codspeed-hq
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
Contributor

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
davidhewitt added a commit to pydantic/pydantic that referenced this pull request Oct 20, 2025
davidhewitt added a commit to pydantic/pydantic that referenced this pull request Oct 22, 2025
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.

3 participants