## Name:

time procedure for timing Sollya code.

## Usage:

time(code) : code -> constant

## Parameters:

• code is the code to be timed.

## Description:

• time permits timing a Sollya instruction, resp. a begin-end block of Sollya instructions. The timing value, measured in seconds, is returned as a Sollya constant (and not merely displayed as for timing). This permits performing computations of the timing measurement value inside Sollya.
• The extended nop command permits executing a defined number of useless instructions. Taking the ratio of the time needed to execute a certain Sollya instruction and the time for executing a nop therefore gives a way to abstract from the speed of a particular machine when evaluating an algorithm's performance.

## Example 1:

> t = time(p=remez(sin(x),10,[-1;1]));
> write(t,"s were spent computing p = ",p,"\n");
0.23269659684359632238691236091281366017852755223478s were spent computing p = -3.3426550293345171908513995127407122194691200059639e-17 + x * (0.99999999973628359955372011464713121003442988167693 + x * (7.8802751877302786684499343799047732495568873819693e-16 + x * (-0.166666661386013037032912982196741385680498698107285 + x * (-5.3734444911159112186289355138557504839692987221233e-15 + x * (8.3333037186548537651002133031675072810009327877148e-3 + x * (1.33797221389218815884112341005509831429347230871284e-14 + x * (-1.98344863018277416493268155154158924422004290239026e-4 + x * (-1.3789116451286674170531616441916183417598709732816e-14 + x * (2.6876259495430304684251822024896210963401672262005e-6 + x * 5.0282378350010211058128384123578805586173782863605e-15)))))))))

## Example 2:

> write(time({ p=remez(sin(x),10,[-1;1]); write("The error is 2^(", log2(dirtyinfnorm(p-sin(x),[-1;1])), ")\n"); }), " s were spent\n");
The error is 2^(log2(2.39602467695631727848641768186659313738474584992648e-11))
0.39557966668768125073358497932015543041045271197384 s were spent

## Example 3:

> t = time(bashexecute("sleep 10"));