On 5 October 2017 at 20:34, oldk1331 <[email protected]> wrote:
> To Bill:
>
> 1. Benchmarking in interpreter is meaningless, I'm sure
> you noticed that you can do 10^6 calls in interpreter in 4s
> while do 2*10^8 calls in 0.4s in compiler.
>
Of course, but not completely meaningless to someone using the interpreter.
> 2. The FriCAS you are using should be built from my branch,
> to have the inline patch, so that functions from Maybe can be
> inlined.
>
OK
> 3. I didn't include array generation code in test function,
> (although it didn't matter much in this case, just my habit)
> so the first call from the benchmark package will generate the
> array so it should not be timed. I also use 'qelt' to avoid
> checking index.
>
OK
> 4. I use "failed2?" to represent the "generic" Maybe case:
> ...
> ----- benchmark result
> -- compile maybe to make "failed2?" available
> (1) -> )co maybe
> (1) -> )co bench-maybe
> (1) -> )time on
> (1) -> f1 1; -- to init the array
> (2) -> f1 200;
> Time: 0.39 (EV) = 0.39 sec
> (3) -> f2 200;
> Time: 0.00 (IN) + 1.22 (EV) + 0.00 (OT) = 1.23 sec
> (4) -> f3 200;
> Time: 0.40 (EV) = 0.40 sec
>
Thank you very much. I reproduced the results above.
(1) -> )co fricas-oldk/src/algebra/maybe.spad
Compiling FriCAS source code from file
/home/wspage/fricas-oldk/src/algebra/maybe.spad using old system
compiler.
...
(1) -> )co maybe-bench-oldk
Compiling FriCAS source code from file
/home/wspage/maybe-bench-oldk.spad using old system compiler.
...
(1) -> )time on
(1) -> f1 1
(1) 1
Type: PositiveInteger
Time: 0.01 (EV) + 0.06 (OT) = 0.07 sec
(2) -> f1 200
(2) 200
Type: PositiveInteger
Time: 0.56 (EV) = 0.56 sec
(3) -> f2 200
(3) 200
Type: PositiveInteger
Time: 1.30 (EV) = 1.30 sec
(4) -> f3 200
(4) 200
Type: PositiveInteger
Time: 0.58 (EV) = 0.58 sec
I also repeated this same benchmark using my reference version of
Maybe. I see that the inlining also benefits the List R representation
so it remains a little faster than all of the above.
--- Maybe benchmark (reference implementation)
)abbrev package TESTM4 TestMaybe4
TestMaybe4() : Exp == Imp where
Exp == with
f4 : Integer -> Integer
Imp == add
NNI ==> NonNegativeInteger
import from Vector NNI
v4 : Vector Maybe NNI := new(10^6, empty())
f4 x ==
v := v4
for j in 1..x repeat
for i in 1..10^6 repeat
empty? qelt(v, i)
x
--
(1) -> )co maybe
Compiling FriCAS source code from file /home/wspage/maybe.spad using
old system compiler.
...
(1) -> )co maybe-bench4
Compiling FriCAS source code from file
/home/wspage/maybe-bench4.spad using old system compiler
....
(1) -> )time on
(1) -> f4 1
(1) 1
Type: PositiveInteger
Time: 0.00 (EV) + 0.04 (OT) = 0.04 sec
(2) -> f4 200
(2) 200
Type: PositiveInteger
Time: 0.48 (EV) = 0.48 sec
Bill Page.
--
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.