Skip to content

CLN/PERF: remove used functions; use C skip list for rolling median #11450

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Nov 2, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
70 changes: 70 additions & 0 deletions asv_bench/benchmarks/gil.py
Original file line number Diff line number Diff line change
Expand Up @@ -366,3 +366,73 @@ def time_period_to_datetime(self):
def run(period):
period.to_timestamp()
run(self.period)


class nogil_rolling_algos_slow(object):
goal_time = 0.2

def setup(self):
self.win = 100
np.random.seed(1234)
self.arr = np.random.rand(100000)
if (not have_real_test_parallel):
raise NotImplementedError

def time_nogil_rolling_median(self):
@test_parallel(num_threads=2)
def run(arr, win):
rolling_median(arr, win)
run(self.arr, self.win)


class nogil_rolling_algos_fast(object):
goal_time = 0.2

def setup(self):
self.win = 100
np.random.seed(1234)
self.arr = np.random.rand(1000000)
if (not have_real_test_parallel):
raise NotImplementedError

def time_nogil_rolling_mean(self):
@test_parallel(num_threads=2)
def run(arr, win):
rolling_mean(arr, win)
run(self.arr, self.win)

def time_nogil_rolling_min(self):
@test_parallel(num_threads=2)
def run(arr, win):
rolling_min(arr, win)
run(self.arr, self.win)

def time_nogil_rolling_max(self):
@test_parallel(num_threads=2)
def run(arr, win):
rolling_max(arr, win)
run(self.arr, self.win)

def time_nogil_rolling_var(self):
@test_parallel(num_threads=2)
def run(arr, win):
rolling_var(arr, win)
run(self.arr, self.win)

def time_nogil_rolling_skew(self):
@test_parallel(num_threads=2)
def run(arr, win):
rolling_skew(arr, win)
run(self.arr, self.win)

def time_nogil_rolling_kurt(self):
@test_parallel(num_threads=2)
def run(arr, win):
rolling_kurt(arr, win)
run(self.arr, self.win)

def time_nogil_rolling_std(self):
@test_parallel(num_threads=2)
def run(arr, win):
rolling_std(arr, win)
run(self.arr, self.win)
29 changes: 27 additions & 2 deletions asv_bench/benchmarks/stat_ops.py
Original file line number Diff line number Diff line change
Expand Up @@ -231,6 +231,31 @@ class stats_rolling_mean(object):

def setup(self):
self.arr = np.random.randn(100000)
self.win = 100

def time_stats_rolling_mean(self):
rolling_mean(self.arr, 100)
def time_rolling_mean(self):
rolling_mean(self.arr, self.win)

def time_rolling_median(self):
rolling_median(self.arr, self.win)

def time_rolling_min(self):
rolling_min(self.arr, self.win)

def time_rolling_max(self):
rolling_max(self.arr, self.win)

def time_rolling_sum(self):
rolling_sum(self.arr, self.win)

def time_rolling_std(self):
rolling_std(self.arr, self.win)

def time_rolling_var(self):
rolling_var(self.arr, self.win)

def time_rolling_skew(self):
rolling_skew(self.arr, self.win)

def time_rolling_kurt(self):
rolling_kurt(self.arr, self.win)
3 changes: 2 additions & 1 deletion doc/source/whatsnew/v0.17.1.txt
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,8 @@ Performance Improvements


- Release the GIL on most datetime field operations (e.g. ``DatetimeIndex.year``, ``Series.dt.year``), normalization, and conversion to and from ``Period``, ``DatetimeIndex.to_period`` and ``PeriodIndex.to_timestamp`` (:issue:`11263`)

- Release the GIL on some srolling algos (``rolling_median``, ``rolling_mean``, ``rolling_max``, ``rolling_min``, ``rolling_var``, ``rolling_kurt``, `rolling_skew`` (:issue:`11450`)
- Improved performance of ``rolling_median`` (:issue:`11450`)

- Improved performance to ``to_excel`` (:issue:`11352`)

Expand Down
Loading