Name:

time procedure for timing Sollya code.

Usage:

time(code) : code -> constant

Parameters:

Description:

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"));
   > write(~(t-10),"s of execution overhead.\n");
   5.0730000000000011195488980320078553631901741027832e-3s of execution overhead.

Example 4:

   > ratio := time(p=remez(sin(x),10,[-1;1]))/time(nop(10));
   > write("This ratio = ", ratio, " should somehow be independent of the type of machine.\n");
   This ratio = 6.2765822195955168678345100827672479521651468951968 should somehow be independent of the type of machine.
See also: timing, nop
Go back to the list of commands