mirror of
https://github.com/wassname/catalyst.git
synced 2026-07-03 11:08:27 +08:00
23ca58813a
For a pipeline doing simple computations on USEquityPricing data, we were spending ~60% of `run_pipeline` loading adjustments. Almost all of that time was spent in calls to `DatetimeIndex.get_loc` to find the indices of adjustment `eff_date`s. This optimizes the eff_date lookups by pre-populating a cache of seconds-since-epoch timestamps that we expect to see, and falling back to `np.searchsorted` on cache misses. In testing, this reduces the time to compute a 1-year pipeline with 30 and 90 day moving averages from 3.1 seconds to 0.9 seconds.