pydata/pandas — pull request #8293 by bjonen (2014-09-17 13:16:48+00:00)
Title: PERF: Improve performance CustmBusinessDay - 2nd

New attempt to close #8236

CustomBusinessDay is now fast with holiday calendar and incrementing in different ways. `busdaycalendar` is cached in self.kwds.
```
In [15]:
date = pd.Timestamp('20120101')
cbday = pd.offsets.CustomBusinessDay()
date + cbday
%timeit date + cbday
100000 loops, best of 3: 14.9 µs per loop
In [16]:
hdays = [dt.datetime(2013,1,1) for ele in range(1000)]
cbdayh = pd.offsets.CustomBusinessDay(holidays=hdays)
cbme = pd.offsets.CustomBusinessMonthEnd(holidays=hdays)
cbmb = pd.offsets.CustomBusinessMonthBegin(holidays=hdays)
%timeit date + cbdayh
%timeit date + 2 * cbdayh
%timeit date - 1 * cbdayh
%timeit date - 10 * cbday
%timeit date + cbmb
%timeit date + 10 * cbmb
%timeit date - 10 * cbmb
%timeit date + cbme
%timeit date + 10 * cbme
%timeit date - 10 * cbme
```

100000 loops, best of 3: 14.8 µs per loop
10000 loops, best of 3: 20.1 µs per loop
10000 loops, best of 3: 24 µs per loop
10000 loops, best of 3: 23.7 µs per loop
10000 loops, best of 3: 108 µs per loop
10000 loops, best of 3: 104 µs per loop
10000 loops, best of 3: 117 µs per loop
10000 loops, best of 3: 118 µs per loop
10000 loops, best of 3: 188 µs per loop
1000 loops, best of 3: 147 µs per loop