[Numpy-discussion] Cython issues w/ 1.4.0

Robert Kern robert.kern@gmail....
Tue Dec 8 15:06:03 CST 2009

On Tue, Dec 8, 2009 at 14:52, Dag Sverre Seljebotn
<dagss@student.matnat.uio.no> wrote:
> Robert Kern wrote:
>> On Tue, Dec 8, 2009 at 12:38, Pauli Virtanen <pav@iki.fi> wrote:

>>> - We need to cache the buffer protocol format string somewhere,
>>>  if we do not want to regenerate it on each buffer acquisition.
>> My suspicion is that YAGNI. I would wait until it is actually in use
>> and we see whether it takes up a significant amount of time in actual
>> code.
> The slight problem with that is that if somebody discover that this is a
> bottleneck in the code, the turnaround time for waiting for a new NumPy
> release could be quite a while. Not that I think it will ever be a problem.

That's true of anything we might do. I'm just skeptical that
regeneration takes so much time that it will significantly affect real
applications. How often are buffers going to be converted, really?
Particularly since one of the points of this interface is to get the
buffer once and read/write into it many times and avoid copying
anything. Adding a struct member or even using the envisioned dynamic
slots is pretty costly, and is not something that we should do for a
cache until there is some profiling done on real applications.
Premature optimization, root of all evil, and all that.

Robert Kern

"I have come to believe that the whole world is an enigma, a harmless
enigma that is made terrible by our own mad attempt to interpret it as
though it had an underlying truth."
  -- Umberto Eco

More information about the NumPy-Discussion mailing list