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");
   3.0207508999999999999999999999999999998615787505353e-2s were spent computing p = 9.0486898749977990986908851357759191711354777014602e-17 * x^10 + 2.68762595115123596299959320959141640012683406736586e-6 * x^9 + -2.4247978492521313349073232289246205727856268698001e-16 * x^8 + -1.98344863020965929701245606503586461226130937598776e-4 * x^7 + 2.2748214757753544349162426281857910162575492126267e-16 * x^6 + 8.3333037186560980567697821420813799547276481409702e-3 * x^5 + -8.574715198972066974170696130354953131211051121887e-17 * x^4 + -0.166666661386013237076216566493953847771564552744173 * x^3 + 1.05699558969863875841493332282097022580493449058156e-17 * x^2 + 0.99999999973628365676559825181776417246038944720795 * x + (-3.1206530956601883024316320853642604562810646600878e-19)

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.39601979446524486606649528289933482070294808074097e-11))
   5.2826264000000000000000000000000000002402474225736e-2 s were spent

Example 3:

   > t = time(bashexecute("sleep 10"));
   > write(~(t-10),"s of execution overhead.\n");
   1.4520270000000000000000000000000000800046706338013e-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 = 1.69095663203027684509460378596823111401980398 should somehow be independent of the type of machine.
See also: timing, nop
Go back to the list of commands