Simplify state hydration benchmark, drop metadata-only test
Type of change
- This change requires a documentation update (docstring)
Changes To Core Features
- Have you added an explanation of what your changes do and why you'd like us to include them?
Description
This PR refactors the state hydration benchmark to focus on what matters for performance regression detection:
Changes:
-
Updated docstring to clarify the benchmark's purpose: measuring complete snapshots of state trees, which inherently exercises the per-class metadata caches (name and parent) during serialization.
-
Removed
test_hydration_metadata— a separate benchmark that only re-read cached metadata without serialization work. This test was problematic because:- With no serialization work to dilute the measurement, CPython's attribute-cache and specialization costs dominated
- These costs move several percent based on what ran earlier in the process, making the benchmark unreliable
- The metadata caches are already exercised (and more meaningfully) by the snapshot benchmark
Rationale:
The snapshot benchmark (test_hydration_snapshot) is the better regression detector because it measures the full serialization pipeline, which naturally exercises metadata caches in a realistic context. Regressions in those caches show up clearly in the snapshot benchmark without the noise from CPU-level caching effects.
Test Plan
Existing benchmark tests pass. The remaining test_hydration_snapshot benchmark continues to exercise state tree hydration and metadata cache performance in a realistic serialization context.