#8135 NORM Not Tri: More extensive use of Numpy

Zarro Boogs per Child bugtracker at laptop.org
Sun Aug 24 11:13:18 EDT 2008


#8135: More extensive use of Numpy
--------------------------+-------------------------------------------------
 Reporter:  seberg        |         Owner:               
     Type:  enhancement   |        Status:  new          
 Priority:  normal        |     Milestone:  Not Triaged  
Component:  not assigned  |       Version:  not specified
 Keywords:  performance   |   Next_action:  code         
 Verified:  0             |     Blockedby:               
 Blocking:                |  
--------------------------+-------------------------------------------------
 I do not know if there is actually a problem with calculations speeds in
 the application. However if there is, there is a few things that could
 drastically speed up the calculations. (np=numpy)

  1. np.fft.rfft is actually about twice as fast as np.fft.fft and as far
 as I see the same for this purpose.
  1. Things like [(abs(x) * 0.02) for x in self.fftx] can be rewritten as
 np.abs(self.fftx) * 0.02. Which will work on an array and is more then 10
 times as fast even for 256 entries. (Ok, I just saw that in the stable
 this is used.)
  1. You can use np.fromstring() to create the data array from the
 soundsample binary input. This should be much faster as well, and you
 don't need to use slow python lists at all. No need to import struct then.

 Overall I would say that this should speed up calculation time by a factor
 of at least 10 or much more.

-- 
Ticket URL: <http://dev.laptop.org/ticket/8135>
One Laptop Per Child <http://laptop.org/>
OLPC bug tracking system


More information about the Bugs mailing list