PyTables/PyTables — pull request #301 by andreabedini (2013-11-12 06:13:26+00:00)
Title: Cythonise idx-opt.c

This is a WIP, please don't merge right now.

In this branch I have replaced the C key sort functions in `idx-opt.c` with an identical python version in `indexesextension.pyx`. The cython version makes use of fused-types to create optimised routines for each type, reducing code duplication and improving maintainability. I couldn't figure out a simple way to unify the code for sorting strings, so that part is still duplicated. I am open to suggestions.

The new cython routines compile to a code almost identical to the original C code (beside what listed below). I have run some benchmarks and they perform very closely (on either side) to the original C version. My code includes the fix for #282.

Although my code should work just fine, I can't be sure I have tested all possible scenarios. I'm working on replacing the bisect functions as well.

Changes:
- I replaced `opt_memcpy` with a direct call to `memcpy`: 1) It didn't seem to affect the benchmark in a noticeable way. 2) the compiler will often optimise the call `memcpy` anyway.

Comments are welcome.

Ping @FrancescAlted @scopatz @avalentino