[Matrix-SIG] Numeric Nits

Rick White rlw@stsci.edu
Tue, 22 Jun 1999 18:39:14 -0400 (EDT)


On Tue, 22 Jun 1999, Paul F. Dubois wrote:

> [... interesting stuff about C++ expression templates ...]
>
>Given the ease of dropping in some "real" C for a few time-critical spots, I
>don't think this area is NumPy's most pressing problem.

I agree that this is not the most pressing problem -- unwanted
promotions are a much bigger memory sink.  If Numeric were changed so
that it reused temporaries, I believe that it would save only one
temporary array worth of memory.  While even one extra image in memory
can sometimes be a problem, it pales compared with the cost of changing
many Float32 arrays to Float64 (and the associated effort of trying to
prevent that.)  Still, if temporaries could be reused it would be
nice.

I'd like to object to the solution of dropping in "real C" for
time-critical spots, though.  That is a fine approach if you are
developing production codes that will be used many times.  In
interactive data analysis, however, the actual computation that is
carried out is different every time.  We explore the data, trying many
different approaches to try to understand what we can learn from it.
In most cases, the time to write a compiled C module would just not be
justified for a one-shot application.  That's why we want to use
Python, after all -- the development time is much faster than C.

Our experience with other array languages (principally IDL) is that the
vast majority of data analysis exploration can be carried out very
effectively without ever using a compiled language.  The overheads that
come from making a pass through the data for each operation are
relatively modest and are acceptable in exchange for easy access to the
data.

Our goal is to make Python comparable in its efficiency to the other
array languages.  Compiled modules can be used to add major new
capabilities to the toolbox (FFTs are a good example), and that is an
important advantage of using Python.  But the basic array operations
really need to be made as fast, simple-to-use, and memory-efficient as
possible.