viirya opened a new pull request, #56167:
URL: https://github.com/apache/spark/pull/56167

   ### What changes were proposed in this pull request?
   
   Convert `_WindowAggArrowBenchMixin` in `python/benchmarks/bench_eval_type.py`
   to the lazy `_scenario_configs` + `@staticmethod _build_scenario(name)` 
pattern
   used by every other mixin in the file, matching the immediately-following
   `_WindowAggPandasBenchMixin`.
   
   ### Why are the changes needed?
   
   SPARK-56244 follow-up (commit 1c807ade4a4) removed eager `_scenarios = 
_build_scenarios()` from all mixins so that importing the benchmark module no 
longer materializes every scenario's Arrow data -- a prerequisite for accurate 
per-scenario `peakmem_*` readings under ASV (ASV reports the max RSS observed 
in the worker process, so any import-time allocation inflates every subsequent 
peakmem result).
   
   SPARK-56120 (`78aaf11728b`, merged the day after the follow-up) reintroduced 
the eager pattern in `_WindowAggArrowBenchMixin`, leaving it as the only mixin 
in the file still doing class-body data construction. As a result, 
`WindowAggArrowUDFPeakmemBench` readings are dominated by the global 
import-time allocation rather than the per-scenario footprint.
   
   Measured locally with `tracemalloc`:
   - before: import peak = 394.54 MiB
   - after:  import peak =  29.17 MiB
   
   ### Does this PR introduce _any_ user-facing change?
   
   No. Test-only change in the benchmark module.
   
   ### How was this patch tested?
   
   - Imported `python.benchmarks.bench_eval_type` and asserted the lazy 
structure is in place (`_scenario_configs` present, `_scenarios` absent, 
`_build_scenario` is a staticmethod).
   - Ran `WindowAggArrowUDFTimeBench.setup` + `time_worker` for 
`(many_groups_sm, few_groups_sm) x (sum_udf, mean_multi_udf)`.
   - Ran `WindowAggArrowUDFPeakmemBench.setup` + `peakmem_worker` for 
`many_groups_sm/sum_udf`.
   - Compared import-time peak memory before/after (numbers above).
   
   ### Was this patch authored or co-authored using generative AI tooling?
   
   Yes. Generated-by: Claude Code (claude-opus-4-7)


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to