Avatar for the pydantic user
pydantic
pydantic-core
BlogDocsChangelog

caching strings from JSON

#1240Merged
Comparing
json-string-caching
(
32de56f
) with
main
(
193f5d7
)
CodSpeed Performance Gauge
+38%
Improvement
1
Untouched
151
New
3

Benchmarks

155 total
test_dict_of_ints_core_json
tests/benchmarks/test_micro_benchmarks.py
CodSpeed Performance Gauge
+38%
1.9 ms1.4 ms
test_list_of_strs_json_uncached
tests/benchmarks/test_micro_benchmarks.py
CodSpeed Performance Gauge
N/A
N/A456 µs
test_list_of_strs_py_cached
tests/benchmarks/test_micro_benchmarks.py
CodSpeed Performance Gauge
N/A
N/A122.5 µs
test_list_of_strs_json_cached
tests/benchmarks/test_micro_benchmarks.py
CodSpeed Performance Gauge
N/A
N/A316.7 µs
test_isinstance_json
tests/benchmarks/test_micro_benchmarks.py
CodSpeed Performance Gauge
+9%
19.1 µs17.5 µs
test_core_json_fs
tests/benchmarks/test_micro_benchmarks.py::TestBenchmarkSimpleModel
CodSpeed Performance Gauge
+9%
135.9 µs125.2 µs
test_set_of_ints_core
tests/benchmarks/test_micro_benchmarks.py
CodSpeed Performance Gauge
+6%
715.4 µs675.4 µs
test_set_of_ints_core_json
tests/benchmarks/test_micro_benchmarks.py
CodSpeed Performance Gauge
+6%
925.5 µs875.7 µs
test_set_of_ints_core_length
tests/benchmarks/test_micro_benchmarks.py
CodSpeed Performance Gauge
+5%
725 µs688.1 µs
test_complete_core_json
tests/benchmarks/test_complete_benchmark.py
CodSpeed Performance Gauge
+4%
510.1 µs490.4 µs
test_strict_union_core
tests/benchmarks/test_micro_benchmarks.py::TestBenchmarkUnion
CodSpeed Performance Gauge
+4%
17 µs16.4 µs
test_dict_of_ints_core
tests/benchmarks/test_micro_benchmarks.py
CodSpeed Performance Gauge
+4%
1 ms1 ms
test_arguments
tests/benchmarks/test_micro_benchmarks.py
CodSpeed Performance Gauge
+3%
26.1 µs25.4 µs
test_int_range_json
tests/benchmarks/test_micro_benchmarks.py
CodSpeed Performance Gauge
+2%
15.8 µs15.4 µs
test_core_string_strict_wrong_str_e
tests/benchmarks/test_micro_benchmarks.py
CodSpeed Performance Gauge
+2%
40 µs39.2 µs
test_validate_literal[json-few_large_strings]
tests/benchmarks/test_micro_benchmarks.py
CodSpeed Performance Gauge
+1%
16.2 µs15.9 µs
test_list_of_dict_models_core
tests/benchmarks/test_micro_benchmarks.py
CodSpeed Performance Gauge
+1%
138.5 µs136.5 µs
test_validate_literal[json-many_large_strings]
tests/benchmarks/test_micro_benchmarks.py
CodSpeed Performance Gauge
+1%
16.1 µs15.9 µs
test_validate_literal[json-many_small_strings]
tests/benchmarks/test_micro_benchmarks.py
CodSpeed Performance Gauge
+1%
15.9 µs15.7 µs
test_date_from_str
tests/benchmarks/test_micro_benchmarks.py::TestBenchmarkDateX
CodSpeed Performance Gauge
+1%
16.6 µs16.4 µs
test_validate_literal[json-few_str_enum]
tests/benchmarks/test_micro_benchmarks.py
CodSpeed Performance Gauge
+1%
20 µs19.8 µs
test_date_from_date
tests/benchmarks/test_micro_benchmarks.py::TestBenchmarkDateX
CodSpeed Performance Gauge
+1%
14 µs13.9 µs
test_complete_core_isinstance
tests/benchmarks/test_complete_benchmark.py
CodSpeed Performance Gauge
+1%
1.8 ms1.8 ms
test_decimal_from_string_pyd
tests/benchmarks/test_micro_benchmarks.py::TestBenchmarkDecimal
CodSpeed Performance Gauge
+1%
33 µs32.7 µs
test_validate_literal[json-few_ints]
tests/benchmarks/test_micro_benchmarks.py
CodSpeed Performance Gauge
+1%
15.5 µs15.4 µs

Commits

Click on a commit to change the comparison range
Base
main
193f5d7
+36.77%
fix signature of from_json
d242b52
2 years ago
by samuelcolvin
-0.85%
support latest jiter
57b5058
2 years ago
by samuelcolvin
-0.01%
change to "cache_str: StringCacheMode"
c9a4675
2 years ago
by samuelcolvin
-2.83%
config tests and list[str] tests
55fde2f
2 years ago
by samuelcolvin
+0.39%
support partial parsing of JSON
af431b4
2 years ago
by samuelcolvin
-0.72%
respect config["cache_strings"] in the json validator
42a9f2f
2 years ago
by samuelcolvin
+5.35%
fix types
32de56f
2 years ago
by samuelcolvin
© 2026 CodSpeed Technology
Home Terms Privacy Docs