PERF: Speedup minute to session sampling.

The minute to session sampling reading was creating two DataFrame
objects, the first to hold the minute data, and then a second returned
by the `DataFrame.groupby` to sample down to sessions.

Instead use the arrays returned by the minute readers `load_raw_arrays`
and implement sampling logic which takes advantage that the minutes
being passed start with the first minute of the first session and end
with the last minute of the last session.

On my machine this takes the tests in `test/test_continuous_futures`
from ~4.0 to about ~0.1 seconds.
This commit is contained in:
Eddie Hebert
2016-10-20 13:43:54 -04:00
parent eff2428068
commit e82fef41dd
5 changed files with 188 additions and 34 deletions
+4
View File
@@ -103,6 +103,10 @@ ext_modules = [
'zipline.utils.calendars._calendar_helpers',
['zipline/utils/calendars/_calendar_helpers.pyx']
),
Extension(
'zipline.data._resample',
['zipline/data/_resample.pyx']
),
]