[Numpy-discussion] rewriting in C (was ANN: Masked Array...)
Russell E. Owen
rowen at cesmail.net
Fri Jan 19 16:24:57 CST 2007
In article <45B13883.7080103 at ee.byu.edu>,
Travis Oliphant <oliphant at ee.byu.edu> wrote:
> Matt Knox wrote:
> >>Moving the implementation to the C-level also has its downside. To
> >>me, at least, Python code is much more readable and hence easier to
> >>Is there a way that we can implement only the speed-critical methods
> >>in C?
> >Implementing the whole thing in C also has the side benefit of the
> >making a nice C level api available to these sub-classes. And I suspect the
> >numpy developers are comfortable enough with C that maintainability is
> >*probably* not a huge concern here.
> >But yeah, implementing even just the speed critical parts in C would still
> >be a
> >nice improvement.
> Part of the trouble is that sometimes the speed critical parts are how
> slow Python functions (e.g. __getitem__) are. You want to avoid that
> function call and the only way to do that (that I know of) is to create
> the sub-class in C.
I'm curious why the low level stuff is in C instead of C++? I would have
thought that C++ templates and possibly even the standard template
library would be a huge win for coding array-type classes.
More information about the Numpy-discussion