[NumPy-Tickets] [NumPy] #1666: Reducing the memory usage of MaskedArrays after DomainedBinaryOperation

NumPy Trac numpy-tickets@scipy....
Thu Nov 11 12:16:33 CST 2010


#1666: Reducing the memory usage of MaskedArrays after DomainedBinaryOperation
-------------------------------+--------------------------------------------
 Reporter:  lee                |       Owner:  pierregm   
     Type:  enhancement        |      Status:  new        
 Priority:  lowest             |   Milestone:  Unscheduled
Component:  numpy.ma           |     Version:  none       
 Keywords:  mask memory usage  |  
-------------------------------+--------------------------------------------
Changes (by pierregm):

  * version:  1.5.0 => none


Comment:

 As you've noticed, the only check performed on the mask of a
 {{{MaskedArray}}} during any operation is whether this mask is set to the
 constant {{{nomask}}} or not. If it is not, we do not check whether it is
 full of False.

 This is a very old design decision from Paul Dubois, the original creator
 of the MaskedArray package for Numeric (NumPy's ancestor), and one I tried
 to stick to as much as possible. The reason behind this design, AFAIU it,
 is to prevent slowing down most of the operations by performing a costly
 action. Therefore, I don't think the patch to numpy.ma.core you suggest is
 that a good idea and I will not support any effort in this direction.

 Now, as I'm prone to put water in my wine those days, I will suggest this
 compromise: we'll try to implement the behavior you want when numpy.ma
 will be ported to C. In that case, speed should be far less of an issue.

 Note that in your own code, if you're really trying to scrape memory, you
 can always call {{{.shrink_mas}}} on your array yourself: it will set a
 mask full of {{{False}}} to {{{nomask}}}.

-- 
Ticket URL: <http://projects.scipy.org/numpy/ticket/1666#comment:2>
NumPy <http://projects.scipy.org/numpy>
My example project


More information about the NumPy-Tickets mailing list