Avatar for the pydantic user
pydantic
pydantic
BlogDocsChangelog

Improve performance of `model_fields_set`

#12924
Comparing
vp/model-fields-set-opt
(
23226e6
) with
main
(
4f818e0
)
CodSpeed Performance Gauge
-13%
Improvement
6
Regression
4
Untouched
199
Ignored
2
Skipped
3

Benchmarks

214 total
test_many_models_core_model
pydantic-core/tests/benchmarks/test_micro_benchmarks.py
CodSpeed Performance Gauge
-13%
2.4 ms2.8 ms
test_getattr
tests/benchmarks/test_attribute_access.py
CodSpeed Performance Gauge
-6%
64.8 µs69.1 µs
test_list_of_strs_json_uncached
pydantic-core/tests/benchmarks/test_micro_benchmarks.py
CodSpeed Performance Gauge
-6%
443.1 µs469.4 µs
test_core_raw
pydantic-core/tests/benchmarks/test_micro_benchmarks.py::TestBenchmarkUUID
CodSpeed Performance Gauge
-6%
15.5 µs16.4 µs
test_core_python
pydantic-core/tests/benchmarks/test_micro_benchmarks.py::TestModelLarge
CodSpeed Performance Gauge
+19%
119.3 µs100 µs
test_nested_schema_inlined
pydantic-core/tests/benchmarks/test_nested_benchmark.py
CodSpeed Performance Gauge
+17%
15.8 ms13.5 ms
test_nested_schema_using_defs
pydantic-core/tests/benchmarks/test_nested_benchmark.py
CodSpeed Performance Gauge
+17%
15 ms12.8 ms
test_core_json_fs
pydantic-core/tests/benchmarks/test_micro_benchmarks.py::TestModelLarge
CodSpeed Performance Gauge
+14%
121.6 µs106.9 µs
test_north_star_validate_python_strict
tests/benchmarks/test_north_star.py
CodSpeed Performance Gauge
+8%
21.1 ms19.5 ms
test_north_star_validate_python
tests/benchmarks/test_north_star.py
CodSpeed Performance Gauge
+5%
33.2 ms31.6 ms
test_north_star_validate_json_strict
tests/benchmarks/test_north_star.py
CodSpeed Performance Gauge
+3%
35.9 ms34.7 ms
test_tagged_union_with_str_discriminator_schema_generation
tests/benchmarks/test_model_schema_generation.py
CodSpeed Performance Gauge
+3%
1.1 ms1.1 ms
test_date_format_function
pydantic-core/tests/benchmarks/test_serialization_micro.py
CodSpeed Performance Gauge
+3%
55.5 µs54.1 µs
test_dataclass_to_json
pydantic-core/tests/benchmarks/test_serialization_micro.py
CodSpeed Performance Gauge
+2%
40.5 µs39.7 µs
test_list_of_models_validation[__init__]
tests/benchmarks/test_model_validation.py
CodSpeed Performance Gauge
+2%
75.1 µs73.8 µs
test_simple_model_validation[model_validate]
tests/benchmarks/test_model_validation.py
CodSpeed Performance Gauge
+2%
40.3 µs39.6 µs
test_complete_core_strict
pydantic-core/tests/benchmarks/test_complete_benchmark.py
CodSpeed Performance Gauge
+1%
238.1 µs235.1 µs
test_complete_core_root
pydantic-core/tests/benchmarks/test_complete_benchmark.py
CodSpeed Performance Gauge
+1%
259.6 µs256.3 µs
test_model_core_json
pydantic-core/tests/benchmarks/test_micro_benchmarks.py::TestBenchmarkUUID
CodSpeed Performance Gauge
+1%
32.3 µs31.9 µs
test_small_class_core_dict
pydantic-core/tests/benchmarks/test_micro_benchmarks.py
CodSpeed Performance Gauge
+1%
19.5 µs19.3 µs
test_json_direct_list_int
pydantic-core/tests/benchmarks/test_serialization_micro.py
CodSpeed Performance Gauge
+1%
149.2 µs147.7 µs
test_validate_literal[python-few_small_strings]
pydantic-core/tests/benchmarks/test_micro_benchmarks.py
CodSpeed Performance Gauge
+1%
16.5 µs16.4 µs
test_core_string_lax
pydantic-core/tests/benchmarks/test_micro_benchmarks.py
CodSpeed Performance Gauge
+1%
15.4 µs15.3 µs
test_validate_literal[json-many_small_strings]
pydantic-core/tests/benchmarks/test_micro_benchmarks.py
CodSpeed Performance Gauge
+1%
17.8 µs17.7 µs
test_north_star_dump_python
tests/benchmarks/test_north_star.py
CodSpeed Performance Gauge
+1%
17.5 ms17.4 ms

Commits

Click on a commit to change the comparison range
Base
main
4f818e0
-12.5%
Do not build full set for now
23226e6
1 month ago
by Viicos
© 2026 CodSpeed Technology
Home Terms Privacy Docs