~/talk

Pydantic Power-up: Performance Tips for Lightning-Fast Python Applications

Talkat PyCon US 2024 · 2024-05-15..05-23· [python]
slides:none on file

Pydantic V2 moves core validation into Rust and claims 5–50x speedups over V1; concrete tips include using model_validate_json to avoid Python materialization, reusing TypeAdapter instances to avoid repeated schema builds, and preferring concrete types like list over Sequence. Tagged (discriminated) unions let the validator pick one branch instead of trying all members, preventing exponential validation blowup and producing clearer errors. Roadmap items: SIMD/JIT accel, validating while parsing to keep data in Rust, and lazy materialization of attributes.

AI-written summary · about

  1. 0:00Introduction to Pydantic
  2. 2:49Basic performance tips
  3. 5:42Tagged unions overview
  4. 8:36Union performance and errors
  5. 10:02Advanced union techniques
  6. 12:09Nested models and unions
  7. 14:01Future performance plans
  8. 14:52Contributing to Pydantic
  9. 18:43Logfire announcement and Q&A
~/search
type to search 6,249 conferences, 138,987 speakers and 185,172 talks
~/help
cmdctrl k
search every conference, speaker and series
/
focus the filter search
h
home
c
conferences
s
speakers
e
series
t
light / dark — the status bar button does the same
?
this help
esc
close this, then clear every filter — or just the search, while you are typing in it

Ignored while you are typing. Pages without a filter rail have no search to focus.