iconEuler Examples

Simple Benchmark for Euler

by R. Grothmann

With the following fucntion, you can bench commands in Euler. See how
long it takes to evaluate commands.
>function bench (f,n=100000) ...
  global empty;
  t=time();
  loop 1 to n
    f(args());
  end;
  s=time()-t;
  "For "|f|" "|(s-empty)/(n/1000)|" msec"
  return s; 
endfunction
Bench the empty command
>empty=0;
>function fempty() endfunction
>empty=bench("fempty");
For fempty 0.00484 msec
Now start benching your commands.
>function fsin () sin(1); endfunction
>bench("fsin");
For fsin 0.00406 msec
>A=[1,2;3,4]; function fmmult () := A.A
>bench("fmmult");
For fmmult 0.00374 msec

Examples Homepage