"for" loop in REPL is insanely slow, shows no difference.

Is this benchmark good enough?

====
)abbrev package BENCH1 Bench1
Bench1() : Exp == Impl where
   Exp == with
     barray0 : PositiveInteger -> Void
     barray1 : PositiveInteger -> Void
     bvector0 : PositiveInteger -> Void
     bvector1 : PositiveInteger -> Void
   Impl == add
     barray0 N ==
       a0 := new(N,1)$IndexedOneDimensionalArray(Integer,0)
       for j in 1..100 repeat
         for i in 1..(N-1) repeat qelt(a0,i)

     barray1 N ==
       a0 := new(N,1)$OneDimensionalArray(Integer)
       for j in 1..100 repeat
         for i in 1..(N-1) repeat qelt(a0,i)

     bvector0 N ==
       a0 := new(N,1)$IndexedVector(Integer,0)
       for j in 1..100 repeat
         for i in 1..(N-1) repeat qelt(a0,i)

     bvector1 N ==
       a0 := new(N,1)$Vector(Integer)
       for j in 1..100 repeat
         for i in 1..(N-1) repeat qelt(a0,i)
====

I do not build a new FriCAS on top of this patch, I just
)read src/lisp/primitives.lisp
)co src/algebra/array1
)co src/algebra/vector

Result for SBCL:

barray0(10^6) before vs. after
1.03 -- 0.51

barray1(10^7) before vs. after
1.94 -- 1.80

The vector results is very similar to array1.

1.  Note that 0-based is 5 times slower than 1-based.
The compiler generated SPADCALL instead of QAREF1,
I don't understand.

2. The "AREF to SVREF" change makes it 7% faster.

3. The change from ELT to QAREF1 makes it 50% faster.

I will test for other lisps later.

-- 
You received this message because you are subscribed to the Google Groups 
"FriCAS - computer algebra system" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/fricas-devel.
For more options, visit https://groups.google.com/d/optout.

Reply via email to