Skip to content

Commit

Permalink
PERF: Limit memmove to >= 256 bytes, relax contiguity requirements
Browse files Browse the repository at this point in the history
 (only the stride in the dimension of the copy matters)
  • Loading branch information
stephenwlin authored and y-p committed Mar 22, 2013
1 parent 4411a29 commit bef52df
Show file tree
Hide file tree
Showing 2 changed files with 618 additions and 439 deletions.
12 changes: 10 additions & 2 deletions pandas/src/generate_code.py
Expand Up @@ -93,7 +93,11 @@ def take_2d_axis0_%(name)s_%(dest)s(ndarray[%(c_type_in)s, ndim=2] values,
cdef:
%(c_type_out)s *v, *o
if values.flags.c_contiguous and out.flags.c_contiguous:
#GH3130
if (values.strides[1] == out.strides[1] and
values.strides[1] == sizeof(%(c_type_out)s) and
sizeof(%(c_type_out)s) * n >= 256):
for i from 0 <= i < n:
idx = indexer[i]
if idx == -1:
Expand Down Expand Up @@ -138,7 +142,11 @@ def take_2d_axis1_%(name)s_%(dest)s(ndarray[%(c_type_in)s, ndim=2] values,
cdef:
%(c_type_out)s *v, *o
if values.flags.f_contiguous and out.flags.f_contiguous:
#GH3130
if (values.strides[0] == out.strides[0] and
values.strides[0] == sizeof(%(c_type_out)s) and
sizeof(%(c_type_out)s) * n >= 256):
for j from 0 <= j < k:
idx = indexer[j]
if idx == -1:
Expand Down

0 comments on commit bef52df

Please sign in to comment.