
Just curious: What is the main strength of the array module in the standard library? Is it footprint/memory usage? Is it speed? If so, at what sizes? I ran some simple benchmarks (creating a list/array, iterating over them to sum up their elements, and extracting the slice foo[::2]) and got the following rations (array_time/list_time) for various sizes: Size 100: Creation: 1.13482142857 Sum: 1.54649265905 Slicing: 1.53736654804 Size 1000: Creation: 1.62444133147 Sum: 1.18439932835 Slicing: 1.56350184957 Size 10000: Creation: 1.61642712328 Sum: 1.47768567821 Slicing: 1.45889354599 Size 100000: Creation: 1.72711084285 Sum: 0.952593142445 Slicing: 1.05782341361 Size 1000000: Creation: 1.56617139425 Sum: 0.735687066032 Slicing: 0.773219364465 Size 10000000: Creation: 1.57903195174 Sum: 0.727253180418 Slicing: 0.726005428022 These benchmarks are pretty naïve, but it seems to me that unless you're working with quite large arrays, there is no great advantage to using arrays rather than lists... (I'm not including numarray or Numeric in the equation here -- I just raise the issue because of the use of arrays in Psymeric...) Just curious... -- Magnus Lie Hetland "Nothing shocks me. I'm a scientist." http://hetland.org -- Indiana Jones

The problem with naïve benchmarks is that they *are* naïve. In real applications you have a lot of arrays running around, and so a full cache shows up with smaller array sizes. Because of this, measuring performance is a really difficult matter.

Paul F Dubois <paul@pfdubois.com>:
The problem with naïve benchmarks is that they *are* naïve.
Indeed. My request was for a more dependable analysis.
In real applications you have a lot of arrays running around, and so a full cache shows up with smaller array sizes. Because of this, measuring performance is a really difficult matter.
Indeed. I guess what I'm curious about is the motivation behind the array module... It seems to be mainly conserving memory -- or? -- Magnus Lie Hetland "Nothing shocks me. I'm a scientist." http://hetland.org -- Indiana Jones
participants (2)
-
Magnus Lie Hetland
-
Paul F Dubois