Artifact 2a59f16dd1d21b72fc2364882c1efac159dbbc4b99d93307513372cb75f4ad7e:
- Executable file
r37/lisp/csl/html/r37_0273.html
— part of check-in
[f2fda60abd]
at
2011-09-02 18:13:33
on branch master
— Some historical releases purely for archival purposes
git-svn-id: https://svn.code.sf.net/p/reduce-algebra/code/trunk/historical@1375 2bfe0521-f11c-4a00-b80e-6202646ff360 (user: arthurcnorman@users.sourceforge.net, size: 1796) [annotate] [blame] [check-ins using] [more...]
<A NAME=COMP> <TITLE>COMP</TITLE></A> <b><a href=r37_idx.html>INDEX</a></b><p><p> <B>COMP</B> _ _ _ _ _ _ _ _ _ _ _ _ <B>switch</B><P> <P> <P> <P> When <em>comp</em> is on, any succeeding function definitions are compiled into a faster-running form. Default is <em>off</em>. <P> <P> <P> <H3> examples: </H3> <P><PRE><TT></TT></PRE><P>The following procedure finds Fibonacci numbers recurs ively. Create a new file ``refib" in your current directory with the following lines in it:<P><PRE><TT> procedure refib(n); if fixp n and n >= 0 then if n <= 1 then 1 else refib(n-1) + refib(n-2) else rederr "nonnegative integer only"; end; </TT></PRE><P>Now load REDUCE and run the following:<P><PRE><TT> on time; Time: 100 ms in "refib"$ Time: 0 ms REFIB Time: 260 ms Time: 20 ms refib(80); 37889062373143906 Time: 14840 ms on comp; Time: 80 ms in "refib"$ Time: 20 ms REFIB Time: 640 ms refib(80); 37889062373143906 Time: 10940 ms </TT></PRE><P> <P> <P> Note that the compiled procedure runs faster. Your time messages will differ depending upon which system you have. Compiled functions remain so for the duration of the REDUCE session, and are then lost. They must be recompiled if wanted in another session. With the switch <A HREF=r37_0333.html>time</A> on as shown above, the CPU time used in executing the command is returned in milliseconds. Be careful not to leave <em>comp</em> on unless you want it, as it makes the processing of procedures much slower. <P> <P> <P> <P>