KEMBAR78
update to PyO3 0.21 beta by davidhewitt · Pull Request #1222 · pydantic/pydantic-core · GitHub
Skip to content

Conversation

@davidhewitt
Copy link
Contributor

Change Summary

This PR updates to PyO3 0.21 beta (and jiter 0.0.7).

It does just the first step of the PyO3 migration which advises to switch on the "gil-refs" feature and solve the rest of the updating. Hence, I've done that here, and I'll use #1085 to merge the follow up which should unlock the real performance boosts.

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 Mar 12, 2024

CodSpeed Performance Report

Merging #1222 will improve performances by 20.33%

Comparing dh/pyo3-0.21-beta (a24b08e) with main (4a533aa)

Summary

⚡ 22 improvements
✅ 126 untouched benchmarks

Benchmarks breakdown

Benchmark main dh/pyo3-0.21-beta Change
test_core_future 47.5 µs 42.3 µs +12.33%
test_core_str 31.9 µs 28.5 µs +12.06%
test_core_future 30.1 µs 25.8 µs +16.76%
test_date_from_datetime 39.2 µs 34.1 µs +15%
test_date_from_datetime_str 30.1 µs 26.7 µs +12.68%
test_date_from_str 26.9 µs 23.4 µs +15.01%
test_core_root_model 95.1 µs 82.4 µs +15.51%
test_definition_in_tree 4.5 ms 4 ms +12.42%
test_generator_rust 32.7 µs 28.7 µs +14.01%
test_list_of_nullable_core 491.6 µs 408.5 µs +20.33%
test_small_class_core_dict 31.9 µs 28.5 µs +12.22%
test_tuple_many_positional 34 µs 30.1 µs +13.12%
test_tuple_many_variable 34 µs 30.1 µs +13.23%
test_validate_literal[json-few_str_enum] 32.8 µs 28.4 µs +15.59%
test_validate_literal[python-few_mixed] 26.9 µs 23.7 µs +13.49%
test_validate_literal[python-few_str_enum] 25 µs 21.1 µs +18.35%
test_with_default 41.8 µs 37.2 µs +12.54%
test_core_model_json 50.2 µs 44.2 µs +13.76%
test_dataclass_serialization_json 44.9 µs 40 µs +12.19%
test_dataclass_serialization_python 43.1 µs 38.4 µs +12.02%
... ... ... ... ...

ℹ️ Only the first 20 benchmarks are displayed. Go to the app to view all benchmarks.

@davidhewitt
Copy link
Contributor Author

@samuelcolvin has given me blessing to merge that, so here we go!

@davidhewitt davidhewitt merged commit 71d54a2 into main Mar 12, 2024
@davidhewitt davidhewitt deleted the dh/pyo3-0.21-beta branch March 12, 2024 19:57
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.

1 participant