Avatar for the pydantic user
pydantic
pydantic-core
BlogDocsChangelog

try using tests/benchmarks as PGO input

#686Closed
Comparing
dh/pgo-2
(
bef03cb
) with
main
(
f43fab3
)
CodSpeed Performance Gauge
+31%
Improvements
51
Untouched
74

Benchmarks

Improved

test_definition_out_of_tree
tests/benchmarks/test_micro_benchmarks.py::test_definition_out_of_tree
CodSpeed Performance Gauge
+31%
1.7 ms1.3 ms
test_set_of_ints_core_duplicates
tests/benchmarks/test_micro_benchmarks.py::test_set_of_ints_core_duplicates
CodSpeed Performance Gauge
+30%
437.5 µs336.8 µs
test_definition_in_tree
tests/benchmarks/test_micro_benchmarks.py::test_definition_in_tree
CodSpeed Performance Gauge
+28%
1,102.2 µs859.5 µs
test_json_direct_list_int
tests/benchmarks/test_serialization_micro.py::test_json_direct_list_int
CodSpeed Performance Gauge
+26%
205.7 µs163.2 µs
test_model_list_core_json
tests/benchmarks/test_serialization_micro.py::test_model_list_core_json
CodSpeed Performance Gauge
+24%
219.6 µs177.7 µs
test_json_any_list_str
tests/benchmarks/test_serialization_micro.py::test_json_any_list_str
CodSpeed Performance Gauge
+23%
340.6 µs276.3 µs
test_json_direct_list_str
tests/benchmarks/test_serialization_micro.py::test_json_direct_list_str
CodSpeed Performance Gauge
+23%
228.2 µs185.4 µs
test_dict_of_ints_core
tests/benchmarks/test_micro_benchmarks.py::test_dict_of_ints_core
CodSpeed Performance Gauge
+23%
1.2 ms1 ms
test_frozenset_of_ints_duplicates_core
tests/benchmarks/test_micro_benchmarks.py::test_frozenset_of_ints_duplicates_core
CodSpeed Performance Gauge
+20%
194.2 µs161.7 µs
test_dict_of_any_core
tests/benchmarks/test_micro_benchmarks.py::test_dict_of_any_core
CodSpeed Performance Gauge
+19%
890.9 µs745.7 µs
test_json_any_list_int
tests/benchmarks/test_serialization_micro.py::test_json_any_list_int
CodSpeed Performance Gauge
+18%
314.6 µs265.9 µs
test_python_json_list_none
tests/benchmarks/test_serialization_micro.py::test_python_json_list_none
CodSpeed Performance Gauge
+18%
145.6 µs123.3 µs
test_list_of_ints_core_py
tests/benchmarks/test_micro_benchmarks.py::test_list_of_ints_core_py
CodSpeed Performance Gauge
+17%
570.6 µs488.4 µs
test_small_class_core_model
tests/benchmarks/test_micro_benchmarks.py::test_small_class_core_model
CodSpeed Performance Gauge
+16%
33.7 µs29.1 µs
test_core_future
tests/benchmarks/test_micro_benchmarks.py::TestBenchmarkDateX::test_core_future
CodSpeed Performance Gauge
+16%
20 µs17.2 µs
test_model_instance_abc
tests/benchmarks/test_micro_benchmarks.py::test_model_instance_abc
CodSpeed Performance Gauge
+16%
38 µs32.9 µs
test_model_instance
tests/benchmarks/test_micro_benchmarks.py::test_model_instance
CodSpeed Performance Gauge
+16%
32.9 µs28.5 µs
test_python_json_list_int
tests/benchmarks/test_serialization_micro.py::test_python_json_list_int
CodSpeed Performance Gauge
+15%
173.3 µs150.4 µs
test_arguments
tests/benchmarks/test_micro_benchmarks.py::test_arguments
CodSpeed Performance Gauge
+15%
27.3 µs23.8 µs
test_python_json_list_str
tests/benchmarks/test_serialization_micro.py::test_python_json_list_str
CodSpeed Performance Gauge
+15%
177 µs154.5 µs
test_list_of_nullable_core
tests/benchmarks/test_micro_benchmarks.py::test_list_of_nullable_core
CodSpeed Performance Gauge
+14%
146 µs128 µs
test_dict_of_ints_core_json
tests/benchmarks/test_micro_benchmarks.py::test_dict_of_ints_core_json
CodSpeed Performance Gauge
+14%
3.2 ms2.8 ms
test_set_of_ints_core_length
tests/benchmarks/test_micro_benchmarks.py::test_set_of_ints_core_length
CodSpeed Performance Gauge
+14%
803.9 µs705.3 µs
test_set_of_ints_core
tests/benchmarks/test_micro_benchmarks.py::test_set_of_ints_core
CodSpeed Performance Gauge
+14%
791.4 µs695 µs
test_many_models_core_model
tests/benchmarks/test_micro_benchmarks.py::test_many_models_core_model
CodSpeed Performance Gauge
+14%
2.9 ms2.5 ms
test_complete_core_json
tests/benchmarks/test_complete_benchmark.py::test_complete_core_json
CodSpeed Performance Gauge
+14%
826.2 µs727.1 µs
test_build_schema
tests/benchmarks/test_complete_benchmark.py::test_build_schema
CodSpeed Performance Gauge
+13%
946.5 µs835.2 µs
test_variable_tuple
tests/benchmarks/test_micro_benchmarks.py::test_variable_tuple
CodSpeed Performance Gauge
+13%
20.2 µs17.8 µs
test_core_json
tests/benchmarks/test_serialization_micro.py::TestBenchmarkSimpleModel::test_core_json
CodSpeed Performance Gauge
+13%
106.4 µs94.3 µs
test_with_default
tests/benchmarks/test_micro_benchmarks.py::test_with_default
CodSpeed Performance Gauge
+13%
24.4 µs21.7 µs
test_frozenset_of_ints_core
tests/benchmarks/test_micro_benchmarks.py::test_frozenset_of_ints_core
CodSpeed Performance Gauge
+13%
294.2 µs261.4 µs
test_core_python_fs
tests/benchmarks/test_micro_benchmarks.py::TestBenchmarkSimpleModel::test_core_python_fs
CodSpeed Performance Gauge
+12%
104.1 µs92.6 µs
test_complete_core_strict
tests/benchmarks/test_complete_benchmark.py::test_complete_core_strict
CodSpeed Performance Gauge
+12%
377.4 µs336.4 µs
test_tuple_many_variable
tests/benchmarks/test_micro_benchmarks.py::test_tuple_many_variable
CodSpeed Performance Gauge
+12%
20.1 µs17.9 µs
test_complete_core_lax
tests/benchmarks/test_complete_benchmark.py::test_complete_core_lax
CodSpeed Performance Gauge
+12%
378 µs337.2 µs
test_list_of_dict_models_core
tests/benchmarks/test_micro_benchmarks.py::test_list_of_dict_models_core
CodSpeed Performance Gauge
+12%
132 µs117.9 µs
test_core_dict
tests/benchmarks/test_serialization_micro.py::TestBenchmarkSimpleModel::test_core_dict
CodSpeed Performance Gauge
+12%
83.3 µs74.4 µs
test_core_root_model
tests/benchmarks/test_micro_benchmarks.py::test_core_root_model
CodSpeed Performance Gauge
+12%
45.7 µs40.9 µs
test_core_future_str
tests/benchmarks/test_micro_benchmarks.py::TestBenchmarkDateX::test_core_future_str
CodSpeed Performance Gauge
+12%
17.7 µs15.8 µs
test_isinstance_json
tests/benchmarks/test_micro_benchmarks.py::test_isinstance_json
CodSpeed Performance Gauge
+12%
20.7 µs18.5 µs
test_small_class_core_dict
tests/benchmarks/test_micro_benchmarks.py::test_small_class_core_dict
CodSpeed Performance Gauge
+12%
20.3 µs18.2 µs
test_generator_rust
tests/benchmarks/test_micro_benchmarks.py::test_generator_rust
CodSpeed Performance Gauge
+12%
20.6 µs18.5 µs
test_core_future_str
tests/benchmarks/test_micro_benchmarks.py::TestBenchmarkDateTime::test_core_future_str
CodSpeed Performance Gauge
+12%
20.5 µs18.4 µs
test_positional_tuple
tests/benchmarks/test_micro_benchmarks.py::test_positional_tuple
CodSpeed Performance Gauge
+12%
20.5 µs18.4 µs
test_date_from_datetime
tests/benchmarks/test_micro_benchmarks.py::TestBenchmarkDateX::test_date_from_datetime
CodSpeed Performance Gauge
+11%
23.4 µs21.1 µs
test_tagged_union_int_keys_python
tests/benchmarks/test_micro_benchmarks.py::test_tagged_union_int_keys_python
CodSpeed Performance Gauge
+11%
22.6 µs20.4 µs
test_int_range_json
tests/benchmarks/test_micro_benchmarks.py::test_int_range_json
CodSpeed Performance Gauge
+11%
14.7 µs13.3 µs
test_core_python
tests/benchmarks/test_micro_benchmarks.py::TestModelLarge::test_core_python
CodSpeed Performance Gauge
+11%
152 µs137.5 µs
test_core_python
tests/benchmarks/test_micro_benchmarks.py::TestBenchmarkDateTime::test_core_python
CodSpeed Performance Gauge
+10%
30 µs27.1 µs
test_core_json_fs
tests/benchmarks/test_micro_benchmarks.py::TestBenchmarkSimpleModel::test_core_json_fs
CodSpeed Performance Gauge
+10%
251.1 µs227.6 µs
test_validate_literal[python-few_str_enum]
tests/benchmarks/test_micro_benchmarks.py::test_validate_literal[python-few_str_enum]
CodSpeed Performance Gauge
+10%
16.3 µs14.8 µs

Passed

test_validate_literal[json-few_str_enum]
tests/benchmarks/test_micro_benchmarks.py::test_validate_literal[json-few_str_enum]
CodSpeed Performance Gauge
+10%
20.9 µs19 µs
test_tuple_many_positional
tests/benchmarks/test_micro_benchmarks.py::test_tuple_many_positional
CodSpeed Performance Gauge
+10%
21.1 µs19.3 µs
test_core_dict_filter
tests/benchmarks/test_serialization_micro.py::TestBenchmarkSimpleModel::test_core_dict_filter
CodSpeed Performance Gauge
+10%
87.2 µs79.6 µs
test_smart_union_coerce_core
tests/benchmarks/test_micro_benchmarks.py::TestBenchmarkUnion::test_smart_union_coerce_core
CodSpeed Performance Gauge
+9%
15.4 µs14.1 µs
test_many_models_core_dict
tests/benchmarks/test_micro_benchmarks.py::test_many_models_core_dict
CodSpeed Performance Gauge
+9%
1.2 ms1.1 ms
test_core_str
tests/benchmarks/test_micro_benchmarks.py::TestBenchmarkDateTime::test_core_str
CodSpeed Performance Gauge
+9%
20 µs18.3 µs
test_validate_literal[json-few_mixed]
tests/benchmarks/test_micro_benchmarks.py::test_validate_literal[json-few_mixed]
CodSpeed Performance Gauge
+9%
18.4 µs16.9 µs
test_chain_list
tests/benchmarks/test_micro_benchmarks.py::test_chain_list
CodSpeed Performance Gauge
+9%
27.8 µs25.6 µs
test_set_of_ints_core_json_duplicates
tests/benchmarks/test_micro_benchmarks.py::test_set_of_ints_core_json_duplicates
CodSpeed Performance Gauge
+9%
1.2 ms1.1 ms
test_core_model_py
tests/benchmarks/test_serialization_micro.py::test_core_model_py
CodSpeed Performance Gauge
+9%
29 µs26.7 µs
test_core_model_json
tests/benchmarks/test_serialization_micro.py::test_core_model_json
CodSpeed Performance Gauge
+9%
27.3 µs25.2 µs
test_isinstance_string_lax_true
tests/benchmarks/test_micro_benchmarks.py::test_isinstance_string_lax_true
CodSpeed Performance Gauge
+8%
11.8 µs10.9 µs
test_definition_model_core
tests/benchmarks/test_micro_benchmarks.py::test_definition_model_core
CodSpeed Performance Gauge
+8%
559.9 µs516.7 µs
test_validate_literal[json-many_ints]
tests/benchmarks/test_micro_benchmarks.py::test_validate_literal[json-many_ints]
CodSpeed Performance Gauge
+8%
13.5 µs12.4 µs
test_model_core_json
tests/benchmarks/test_micro_benchmarks.py::TestBenchmarkDateTime::test_model_core_json
CodSpeed Performance Gauge
+8%
37.3 µs34.4 µs
test_complete_core_isinstance
tests/benchmarks/test_complete_benchmark.py::test_complete_core_isinstance
CodSpeed Performance Gauge
+8%
2 ms1.9 ms
test_validate_literal[json-few_ints]
tests/benchmarks/test_micro_benchmarks.py::test_validate_literal[json-few_ints]
CodSpeed Performance Gauge
+8%
13.5 µs12.4 µs
test_core_future
tests/benchmarks/test_micro_benchmarks.py::TestBenchmarkDateTime::test_core_future
CodSpeed Performance Gauge
+8%
27.5 µs25.5 µs
test_core_string_strict
tests/benchmarks/test_micro_benchmarks.py::test_core_string_strict
CodSpeed Performance Gauge
+8%
11.6 µs10.8 µs
test_isinstance_string_strict_true
tests/benchmarks/test_micro_benchmarks.py::test_isinstance_string_strict_true
CodSpeed Performance Gauge
+8%
11.8 µs10.9 µs
test_core_string_lax
tests/benchmarks/test_micro_benchmarks.py::test_core_string_lax
CodSpeed Performance Gauge
+8%
11.6 µs10.8 µs
test_chain_two_functions
tests/benchmarks/test_micro_benchmarks.py::test_chain_two_functions
CodSpeed Performance Gauge
+8%
32.3 µs30.1 µs
test_chain_function
tests/benchmarks/test_micro_benchmarks.py::test_chain_function
CodSpeed Performance Gauge
+7%
27.4 µs25.5 µs
test_smart_union_core
tests/benchmarks/test_micro_benchmarks.py::TestBenchmarkUnion::test_smart_union_core
CodSpeed Performance Gauge
+7%
13.7 µs12.7 µs
test_bytes_core
tests/benchmarks/test_micro_benchmarks.py::test_bytes_core
CodSpeed Performance Gauge
+7%
11.6 µs10.8 µs
test_core_string_strict_wrong
tests/benchmarks/test_micro_benchmarks.py::test_core_string_strict_wrong
CodSpeed Performance Gauge
+7%
26.5 µs24.7 µs
test_core_string_lax_wrong
tests/benchmarks/test_micro_benchmarks.py::test_core_string_lax_wrong
CodSpeed Performance Gauge
+7%
26.9 µs25.1 µs
test_int_range
tests/benchmarks/test_micro_benchmarks.py::test_int_range
CodSpeed Performance Gauge
+7%
13.9 µs12.9 µs
test_core_json_fs
tests/benchmarks/test_micro_benchmarks.py::TestModelLarge::test_core_json_fs
CodSpeed Performance Gauge
+7%
238 µs221.9 µs
test_bool_core
tests/benchmarks/test_micro_benchmarks.py::test_bool_core
CodSpeed Performance Gauge
+7%
22.4 µs20.9 µs
test_core_model_json_extra
tests/benchmarks/test_serialization_micro.py::test_core_model_json_extra
CodSpeed Performance Gauge
+7%
32 µs29.9 µs
test_validate_literal[json-few_small_strings]
tests/benchmarks/test_micro_benchmarks.py::test_validate_literal[json-few_small_strings]
CodSpeed Performance Gauge
+7%
14.5 µs13.5 µs
test_date_from_str
tests/benchmarks/test_micro_benchmarks.py::TestBenchmarkDateX::test_date_from_str
CodSpeed Performance Gauge
+7%
17.7 µs16.6 µs
test_model_exclude_unset_false
tests/benchmarks/test_serialization_micro.py::test_model_exclude_unset_false
CodSpeed Performance Gauge
+7%
31.3 µs29.3 µs
test_validate_literal[json-few_large_strings]
tests/benchmarks/test_micro_benchmarks.py::test_validate_literal[json-few_large_strings]
CodSpeed Performance Gauge
+7%
14.7 µs13.8 µs
test_validate_literal[json-many_small_strings]
tests/benchmarks/test_micro_benchmarks.py::test_validate_literal[json-many_small_strings]
CodSpeed Performance Gauge
+7%
14.5 µs13.6 µs
test_to_string_format
tests/benchmarks/test_serialization_micro.py::test_to_string_format
CodSpeed Performance Gauge
+7%
24.9 µs23.3 µs
test_generator_python
tests/benchmarks/test_micro_benchmarks.py::test_generator_python
CodSpeed Performance Gauge
+7%
30.2 µs28.3 µs
test_datetime
tests/benchmarks/test_serialization_micro.py::test_datetime
CodSpeed Performance Gauge
+6%
30 µs28.2 µs
test_strict_int
tests/benchmarks/test_micro_benchmarks.py::test_strict_int
CodSpeed Performance Gauge
+6%
11.6 µs10.9 µs
test_strict_union_error_core
tests/benchmarks/test_micro_benchmarks.py::TestBenchmarkUnion::test_strict_union_error_core
CodSpeed Performance Gauge
+6%
29.1 µs27.4 µs
test_validate_literal[json-many_large_strings]
tests/benchmarks/test_micro_benchmarks.py::test_validate_literal[json-many_large_strings]
CodSpeed Performance Gauge
+6%
14.8 µs13.9 µs
test_validate_literal[python-few_small_strings]
tests/benchmarks/test_micro_benchmarks.py::test_validate_literal[python-few_small_strings]
CodSpeed Performance Gauge
+6%
12.4 µs11.6 µs
test_list_of_any_core_py
tests/benchmarks/test_micro_benchmarks.py::test_list_of_any_core_py
CodSpeed Performance Gauge
+6%
106.7 µs100.5 µs
test_isinstance_string_strict_false
tests/benchmarks/test_micro_benchmarks.py::test_isinstance_string_strict_false
CodSpeed Performance Gauge
+6%
12.5 µs11.8 µs
test_to_string_direct
tests/benchmarks/test_serialization_micro.py::test_to_string_direct
CodSpeed Performance Gauge
+6%
19.8 µs18.7 µs
test_core_raw
tests/benchmarks/test_micro_benchmarks.py::TestBenchmarkDateTime::test_core_raw
CodSpeed Performance Gauge
+6%
11.6 µs11 µs
test_isinstance_string_lax_false
tests/benchmarks/test_micro_benchmarks.py::test_isinstance_string_lax_false
CodSpeed Performance Gauge
+6%
12.9 µs12.2 µs
test_validate_literal[python-many_small_strings]
tests/benchmarks/test_micro_benchmarks.py::test_validate_literal[python-many_small_strings]
CodSpeed Performance Gauge
+6%
12.4 µs11.7 µs
test_model_exclude_unset_true
tests/benchmarks/test_serialization_micro.py::test_model_exclude_unset_true
CodSpeed Performance Gauge
+6%
37.6 µs35.5 µs
test_complete_core_error
tests/benchmarks/test_complete_benchmark.py::test_complete_core_error
CodSpeed Performance Gauge
+6%
2 ms1.9 ms
test_tagged_union_int_keys_json
tests/benchmarks/test_micro_benchmarks.py::test_tagged_union_int_keys_json
CodSpeed Performance Gauge
+6%
29.4 µs27.8 µs
test_chain_nested_functions
tests/benchmarks/test_micro_benchmarks.py::test_chain_nested_functions
CodSpeed Performance Gauge
+6%
32.5 µs30.7 µs
test_date_from_date
tests/benchmarks/test_micro_benchmarks.py::TestBenchmarkDateX::test_date_from_date
CodSpeed Performance Gauge
+6%
11.9 µs11.2 µs
test_date_format_function
tests/benchmarks/test_serialization_micro.py::test_date_format_function
CodSpeed Performance Gauge
+5%
52.9 µs50.2 µs
test_validate_literal[python-few_mixed]
tests/benchmarks/test_micro_benchmarks.py::test_validate_literal[python-few_mixed]
CodSpeed Performance Gauge
+5%
16.7 µs15.9 µs
test_strict_union_core
tests/benchmarks/test_micro_benchmarks.py::TestBenchmarkUnion::test_strict_union_core
CodSpeed Performance Gauge
+5%
15 µs14.3 µs
test_raise_error_value_error
tests/benchmarks/test_micro_benchmarks.py::test_raise_error_value_error
CodSpeed Performance Gauge
+5%
36.3 µs34.5 µs
test_date_from_datetime_str
tests/benchmarks/test_micro_benchmarks.py::TestBenchmarkDateX::test_date_from_datetime_str
CodSpeed Performance Gauge
+5%
19.4 µs18.4 µs
test_date_format_function_no_info
tests/benchmarks/test_serialization_micro.py::test_date_format_function_no_info
CodSpeed Performance Gauge
+5%
51.6 µs49.2 µs
test_validate_literal[python-few_ints]
tests/benchmarks/test_micro_benchmarks.py::test_validate_literal[python-few_ints]
CodSpeed Performance Gauge
+5%
12.4 µs11.8 µs
test_dont_raise_error_no_info
tests/benchmarks/test_micro_benchmarks.py::test_dont_raise_error_no_info
CodSpeed Performance Gauge
+5%
16.4 µs15.6 µs
test_core_string_strict_wrong_str_e
tests/benchmarks/test_micro_benchmarks.py::test_core_string_strict_wrong_str_e
CodSpeed Performance Gauge
+5%
43.5 µs41.6 µs
test_validate_literal[python-many_ints]
tests/benchmarks/test_micro_benchmarks.py::test_validate_literal[python-many_ints]
CodSpeed Performance Gauge
+5%
12.4 µs11.9 µs
test_int_error
tests/benchmarks/test_micro_benchmarks.py::test_int_error
CodSpeed Performance Gauge
+5%
43.1 µs41.2 µs
test_dont_raise_error
tests/benchmarks/test_micro_benchmarks.py::test_dont_raise_error
CodSpeed Performance Gauge
+5%
18.3 µs17.5 µs
test_set_of_ints_core_json
tests/benchmarks/test_micro_benchmarks.py::test_set_of_ints_core_json
CodSpeed Performance Gauge
+4%
1.5 ms1.4 ms
test_list_of_ints_core_json
tests/benchmarks/test_micro_benchmarks.py::test_list_of_ints_core_json
CodSpeed Performance Gauge
+4%
1.3 ms1.3 ms
test_date_format
tests/benchmarks/test_serialization_micro.py::test_date_format
CodSpeed Performance Gauge
+4%
49.9 µs47.8 µs
test_raise_error_custom
tests/benchmarks/test_micro_benchmarks.py::test_raise_error_custom
CodSpeed Performance Gauge
+4%
36 µs34.6 µs
test_filter
tests/benchmarks/test_serialization_micro.py::test_filter
CodSpeed Performance Gauge
+4%
45.5 µs43.6 µs
test_validate_literal[python-many_large_strings]
tests/benchmarks/test_micro_benchmarks.py::test_validate_literal[python-many_large_strings]
CodSpeed Performance Gauge
+4%
12.3 µs11.8 µs
test_core_model_py_extra
tests/benchmarks/test_serialization_micro.py::test_core_model_py_extra
CodSpeed Performance Gauge
+4%
32.7 µs31.4 µs
test_validate_literal[python-few_large_strings]
tests/benchmarks/test_micro_benchmarks.py::test_validate_literal[python-few_large_strings]
CodSpeed Performance Gauge
+4%
12.3 µs11.8 µs

Commits

Click on a commit to change the comparison range
Base
main
f43fab3
+37.01%
try using tests/benchmarks as PGO input
985f097
2 years ago
by davidhewitt
-6.37%
try using tests/benchmarks as PGO input
bef03cb
2 years ago
by davidhewitt
© 2025 CodSpeed Technology
Home Terms Privacy Docs