<div>I run the following test to show that ecase is not jumping directly</div><div>to the given step (less efficient then (go step)):</div><div><br></div><div>(defmacro gostep (step)</div><div> `(block nil (tagbody (go ,step)</div>
<div><span class="Apple-tab-span" style="white-space:pre"> </span>,@(loop for i = 0 then (1+ i)</div><div><span class="Apple-tab-span" style="white-space:pre"> </span> while (< i 100)</div><div><span class="Apple-tab-span" style="white-space:pre"> </span> append `(,i (return-from nil ,i) (go end)))</div>
<div><span class="Apple-tab-span" style="white-space:pre"> </span>end)))</div><div><br></div><div>(defmacro define-runstep ()</div><div> `(defun runstep (step)</div><div><span class="Apple-tab-span" style="white-space:pre"> </span>(block nil </div>
<div><span class="Apple-tab-span" style="white-space:pre"> </span> (ecase step</div><div><span class="Apple-tab-span" style="white-space:pre"> </span>,@(loop for i = 0 then (1+ i)</div><div><span class="Apple-tab-span" style="white-space:pre"> </span> while (< i 100)</div>
<div><span class="Apple-tab-span" style="white-space:pre"> </span> collect `(,i (return-from nil ,i)))</div><div><span class="Apple-tab-span" style="white-space:pre"> </span>))))</div><div><br></div><div>(define-runstep)</div>
<div><br></div><div>? (time (dotimes (i 10000000) (gostep 99)))</div><div>(DOTIMES (I 10000000) (GOSTEP 99)) took 30 milliseconds (0.030 seconds) to run </div><div> with 2 available CPU cores.</div><div>
During that period, 30 milliseconds (0.030 seconds) were spent in user mode</div><div> 0 milliseconds (0.000 seconds) were spent in system mode</div><div>NIL</div><div>? (time (dotimes (i 10000000) (runstep 99)))</div>
<div>(DOTIMES (I 10000000) (RUNSTEP 99)) took 988 milliseconds (0.988 seconds) to run </div><div> with 2 available CPU cores.</div><div>During that period, 986 milliseconds (0.986 seconds) were spent in user mode</div>
<div> 0 milliseconds (0.000 seconds) were spent in system mode</div><div>NIL</div><div><br></div><div><br></div><div>-Taoufik</div><br><div class="gmail_quote">On Wed, Dec 8, 2010 at 6:11 PM, Alexander Repenning <span dir="ltr"><<a href="mailto:ralex@cs.colorado.edu">ralex@cs.colorado.edu</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;"><div class="im"><br>
On Dec 8, 2010, at 9:52 AM, Taoufik Dachraoui wrote:<br>
<br>
> It is not exactly what I am looking for, I would like to jump directly to the step.<br>
> The ecase will check all the clauses in order (like cond) until it finds a match.<br>
<br>
<br>
</div>duno what CCL does in this particular case but most compilers could generate a jump and would not have to test all the previous clauses. In other words this is an implementation question.<br>
<br>
alex<br>
<br>
<br>
<br>
</blockquote></div><br>