Subject: use_fast_arrays is slow in GCL for hash tables
From: Barton Willis
Date: Tue, 3 Jul 2012 18:59:49 +0000
Assign and access a 40,000 member hashtable
GCL: 100.6400 seconds
CCL: 0.7800 seconds
This has been pointed out before, I think. The code:
(%i1) showtime : true$
Evaluation took 0.0000 seconds (0.0000 elapsed)
(%i2) block([use_fast_arrays : true, n : 200],
(for i : 1 thru n do for j : 1 thru n do a[i,j] : i+j,
s : 0,
for i : 1 thru n do for j : 1 thru n do s : s + a[i,j]));
Evaluation took 100.6400 seconds (100.6400 elapsed)
(%o2) done
(%i3) s;
Evaluation took 0.0000 seconds (0.0000 elapsed)
(%o3) 8040000
(%i4) block([use_fast_arrays : false, n : 200],
(for i : 1 thru n do for j : 1 thru n do b[i,j] : i+j,
s : 0,
for i : 1 thru n do for j : 1 thru n do s : s + b[i,j]));
Evaluation took 0.7700 seconds (0.7700 elapsed)
(%o4) done
(%i5) s;
Evaluation took 0.0000 seconds (0.0000 elapsed)
(%o5) 8040000
With CCL:
(%i1) showtime : true$
Evaluation took 0.0000 seconds (0.0000 elapsed)
(%i2) block([use_fast_arrays : true, n : 200],
(for i : 1 thru n do for j : 1 thru n do a[i,j] : i+j,
s : 0,
for i : 1 thru n do for j : 1 thru n do s : s + a[i,j]));
Evaluation took 0.7800 seconds (0.7800 elapsed)
(%o2) done
(%i3) s;
Evaluation took 0.0000 seconds (0.0000 elapsed)
(%o3) 8040000
(%i4) block([use_fast_arrays : false, n : 200],
(for i : 1 thru n do for j : 1 thru n do b[i,j] : i+j,
s : 0,
for i : 1 thru n do for j : 1 thru n do s : s + b[i,j]));
Evaluation took 0.8892 seconds (0.8900 elapsed)
(%o4) done
(%i5) s;
Evaluation took 0.0000 seconds (0.0000 elapsed)
(%o5) 8040000
(%i6)
--Barton