![]() |
|
Navigation |
Synopsis User time in nanoseconds (10
-9 sec).
Function
Usage
import util::Benchmark;
Description
Examples We use the factorial function described in Recipes:Factorial as example:
rascal>import util::Benchmark; ok rascal>import demo::basic::Factorial; okHere we measure time by using separate calls to userTime before and after a call to fac .
rascal>before = userTime(); int: 169265836000 rascal>fac(50); int: 30414093201713378043612608166064768844377641568960512000000000000 rascal>userTime() - before; int: 8934000The code to be measured can also be passed as a function parameter to userTime :
rascal>userTime( void() { fac(50); } );
int: 686000
![]() |