API: allow negative steps for label-based indexing by immerrr · Pull Request #8753 · pandas-dev/pandas (original) (raw)

I've been doing some benchmarking and found the strangest thing: I couldn't get a stable result from panel_methods.panel_pct_change_major benchmark, it reported anything from 2000ms to 8000ms. It appears that the task is memory intensive (easily several gbs of ram) and leaves a lot of objects in its wake because timeit disables garbage collection during the benchmarks. The problem is that it doesn't do any cleanup afterwards and this slows down subsequent runs because malloc has harder time finding chunks of memory when requested.

Given usually there's no such thing as "run code before each iteration, but don't benchmark it" in benchmark libraries, I wonder what's the proper way to fix this... Maybe we should just reduce panel sizes in panel benchmarks.