pydata/pandas — pull request #2867 by stephenwlin (2013-02-13 17:36:19+00:00)
Title: ENH: Consolidation and further optimization of take functions in common

I've consolidated `take_nd`, `ndtake`, and `take_fast` into a single signature `take_nd` which has cleaner semantics (which is documented in a docstring), at least preserves the existing performance properties in all cases, and improves it (sometimes significantly) in some. (In particular, computation of intermediate arrays like boolean masks are still being short-circuited in the same way they were before, in the appropriate situations.) The operation that used to be `take_fast` was also broken for non-NA `fill_value`: this is fixed too.

In addition, I've optimized the Cython implementations of 2-D takes to use row-wise or column-wise `memcpy`s automatically in places where it is appropriate (same type input and output, non-object type, both c-contiguous if slice axis is 0, both f-contiguous if slice axis is 1)...

Tests with Improved performance:
```
Results:
t_head t_baseline ratio
name
frame_reindex_axis0 0.6845 3.2839 0.2084
frame_reindex_axis1 4.0088 5.4203 0.7396
frame_boolean_row_select 0.2932 0.3939 0.7443
```

All other ratios are apparently just statistical noise within the +- 10% range that vary from run to run. (Was hoping it would help more, but I guess this is OK)