how about we get rid of "fast arrays"



Robert Dodier wrote:

>Considering that "fast arrays" (native Lisp hash tables) are, for most
>implementations, so far as I know, not much faster than Maxima hash
>tables,

For undeclared arrays, here is a test that shows use_fast_arrays
should be renamed use_slow_arrays :( The test creates a 1000 x 1000
element hashtable with integer keys.  Using CCL, the test takes 23
seconds with use_fast_arrays : false and 134 seconds with
use_fast_arrays : true to create the table.  Oops.  Maybe Camm's
update for GCL's hash function will make make GCL hashtables fast for
this test.

For declared arrays, I don't think there is much speed difference.

The output:

Maxima branch_5_27_base_132_g50ac673_dirty http://maxima.sourceforge.net
using Lisp Clozure Common Lisp Version 1.8-r15286M  (WindowsX8664)

(%i5) for i thru n do (for j thru n do a[i,j]:1)
Evaluation took 23.2753 seconds (23.3600 elapsed)

(%i6) (s:0,for i thru n do (for j thru n do s:a[i,j]+s),s)
Evaluation took 23.4470 seconds (23.5180 elapsed)
(%o6) 1000000

(%i7) use_fast_arrays:true
Evaluation took 0.0000 seconds (0.0000 elapsed)

(%i8) for i thru n do (for j thru n do b[i,j]:1)
Evaluation took 134.0673 seconds (135.5170 elapsed)

(%i9) (s:0,for i thru n do (for j thru n do s:b[i,j]+s),s)
Evaluation took 58.8748 seconds (59.2180 elapsed)
(%o9) 1000000

(%i10) use_fast_arrays:false
Evaluation took 0.0000 seconds (0.0000 elapsed)

(%i11) array(larry,n,n)
Evaluation took 0.4992 seconds (0.5010 elapsed)

(%i12) for i thru n do (for j thru n do larry[i,j]:1)
Evaluation took 7.1292 seconds (7.1180 elapsed)

(%i13) (s:0,for i thru n do (for j thru n do s:larry[i,j]+s),s)
Evaluation took 7.4256 seconds (7.4630 elapsed)

(%o13) 1000000
(%i14) use_fast_arrays:true
Evaluation took 0.0000 seconds (0.0000 elapsed)

(%i15) array(billy,1000,1000)
Evaluation took 0.0000 seconds (0.0030 elapsed)
(%i16) for i thru n do (for j thru n do billy[i,j]:1)
Evaluation took 6.3024 seconds (6.3120 elapsed)

(%i17) (s:0,for i thru n do (for j thru n do s:billy[i,j]+s),s)
Evaluation took 7.0044 seconds (7.0180 elapsed)
(%o17) 1000000

The test:

n : 1000$
display2d : false$
showtime : all$
for i : 1 thru n do for j  : 1 thru n do a[i,j] : 1$
(s : 0, for i : 1 thru n do for j : 1 thru n do s : s + a[i,j],s);
use_fast_arrays : true$
for i : 1 thru n do for j  : 1 thru n do b[i,j] : 1$
(s : 0, for i : 1 thru n do for j : 1 thru n do s : s + b[i,j],s);
use_fast_arrays : false$
array(larry,n,n)$
for i : 1 thru n do for j  : 1 thru n do larry[i,j] : 1$
(s : 0, for i : 1 thru n do for j : 1 thru n do s : s + larry[i,j],s);
use_fast_arrays : true$
array(billy,''n,''n)$
for i : 1 thru n do for j  : 1 thru n do billy[i,j] : 1$
(s : 0, for i : 1 thru n do for j : 1 thru n do s : s + billy[i,j],s);

--Barton