[IronPython] Multidimensional array performance on IP Beta 9

Milman, Seth Seth_Milman at bose.com
Thu Jul 13 22:30:42 CEST 2006


I've noticed a rather large degradation in speed when accessing elements
in multidimensional arrays in the new beta 9.  Is this performance
expected?

 

I've pasted a script below that demonstrates the issue.

 

Beta 8 output from the script:

1 dimensional copy: 0.4303053 seconds

2 dimensional copy: 1.1508165 seconds

 

Beta 9 output from the script:

            1 dimensional copy: 0.4603266 seconds

2 dimensional copy: 7.5953889 seconds

 

Beta 9 takes 6.6 times longer to access all the elements in the 2d
array.

 

Is this change expected?

 

-Seth

 

 

# ###############################################

import System

from System import *

 

 

arraySize = 50000

 

a1 = Array.CreateInstance( Double, arraySize )

a2 = Array.CreateInstance( Double, arraySize )

a3 = Array.CreateInstance( Double, 2, arraySize )

 

 

ticks1 = DateTime.Now.Ticks

 

for j in range(2):

            for i in range(len(a1)):

                        a2[i] = a1[i]

                        

ticks2 = DateTime.Now.Ticks

 

for j in range(2):

            for i in range(len(a1)):

                        a3[j,i] = a1[i]

                        

ticks3 = DateTime.Now.Ticks

                        

time1 = TimeSpan( ticks2 - ticks1 )

time2 = TimeSpan( ticks3 - ticks2 )

 

print

print '1 dimensional copy: ' + str(time1.TotalSeconds) + ' seconds'

print '2 dimensional copy: ' + str(time2.TotalSeconds) + ' seconds'

print

 

# ###############################################################

            

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/ironpython-users/attachments/20060713/8aa81c4d/attachment.html>


More information about the Ironpython-users mailing list