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.20540799999999999998160499226074193757085595279932s 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.5747151989720669741706961303549531312110511218869e-17 * x^4 + -0.166666661386013237076216566493953847771564552744173 * x^3 + 1.05699558969863875841493332282097022580493449058156e-17 * x^2 + 0.99999999973628365676559825181776417246038944720794 * x + (-3.12065309566018830243163208536426045628106466008778e-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))
   0.365319999999999999980640486008098832826362922787666 s were spent

Example 3:

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