Skip to content

Conversation

@davidhewitt
Copy link

This appears to fix the performance regression on x86_64 CPUs (at least on my local dev box).

CPU profiles suggested that v.is_null has a fair amount of dynamic dispatch indirection (it's an &Arc<dyn Array> cast itself as &dyn Array). Extracting the logical_nulls out (should be ~ a reference count cycle for simple arrays) allows better inlining.

I guess this might have somehow upset the x86_64 branch predictor? Maybe the dynamic dispatch made the call chain complex enough that the branch predictor was preempting the result of is_null incorrectly.

@adriangb adriangb merged commit 2db9927 into pydantic:refactor-in-list Nov 14, 2025
14 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants