Revision: 8965 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=8965&view=rev Author: efiring Date: 2011-02-09 04:16:08 +0000 (Wed, 09 Feb 2011)
Log Message: ----------- Normalize: major speed-up via bypassing masked array division Modified Paths: -------------- trunk/matplotlib/lib/matplotlib/colors.py Modified: trunk/matplotlib/lib/matplotlib/colors.py =================================================================== --- trunk/matplotlib/lib/matplotlib/colors.py 2011-02-08 13:27:16 UTC (rev 8964) +++ trunk/matplotlib/lib/matplotlib/colors.py 2011-02-09 04:16:08 UTC (rev 8965) @@ -853,8 +853,11 @@ mask = ma.getmask(result) result = ma.array(np.clip(result.filled(vmax), vmin, vmax), mask=mask) - result -= vmin - result /= vmax - vmin + # ma division is very slow; we can take a shortcut + resdat = result.data + resdat -= vmin + resdat /= (vmax - vmin) + result = np.ma.array(resdat, mask=result.mask, copy=False) if is_scalar: result = result[0] return result This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. ------------------------------------------------------------------------------ The ultimate all-in-one performance toolkit: Intel(R) Parallel Studio XE: Pinpoint memory and threading errors before they happen. Find and fix more than 250 security defects in the development cycle. Locate bottlenecks in serial and parallel code that limit performance. http://p.sf.net/sfu/intel-dev2devfeb _______________________________________________ Matplotlib-checkins mailing list Matplotlib-checkins@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-checkins