<html><head></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><div>Oh, wow. So I was testing this in Geiser repl in emacs:</div><div>(2467 4631 4088 3934) Where apparently "slower" one wins</div><div><br></div><div>But in DrRacket the result looks plausible:</div><div>(8994 1859 1094 865)</div><div><br></div>Does that mean Geiser shouldn't be trusted?<div><br><div apple-content-edited="true">
<div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; ">---</div><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; ">Vlad Kozin <<a href="mailto:vladilen.kozin@gmail.com">vladilen.kozin@gmail.com</a>><br><br><br></div></div>
</div>
<br><div><div>On Oct 2, 2013, at 1:57 PM, Laurent wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><div dir="ltr"><div><div><div>What values do you get?<br></div>For 4'000 strings (old slow computer), I get:<br>(236 148 84 84)<br></div><div>for slow, medium, fast, really fast, which is consistent with Jay's post.<br>

</div><br></div>Laurent<br></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Wed, Oct 2, 2013 at 7:28 PM, Vlad Kozin <span dir="ltr"><<a href="mailto:vladilen.kozin@gmail.com" target="_blank">vladilen.kozin@gmail.com</a>></span> wrote:<br>

<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="word-wrap:break-word">Mostly a question to Jay McCarthy but I suppose could be interesting to others. Was going over his <a href="http://jeapostrophe.github.io/2013-08-19-reverse-post.html" target="_blank">Reversing strings</a> article. Somehow I get weird performance. Slowest solution turns out fastest, medium, fast and really fast are only marginally different.<div>

<br></div><div>Could anyone have a look <a href="https://github.com/vkz/warm-up" target="_blank">https://github.com/vkz/warm-up</a></div><div>reverse-string.rkt has the solutions</div><div>test-reverse-string.rkt does the performance check</div>

<div>Testing it on 40'000 randomly generated strings 1000 chars each.</div><div><br></div><div>While we're at it, why do we garbage-collect thrice here?</div><div><table style="text-indent:0px;letter-spacing:normal;text-align:left;font-variant:normal;font-style:normal;font-weight:normal;line-height:normal;text-transform:none;white-space:nowrap;font-family:monospace;word-spacing:0px" cellspacing="0">

<tbody><tr style="white-space:inherit"><td style="padding-left:0px;padding-right:0px;vertical-align:baseline;white-space:inherit"><span style="font-family:monospace;white-space:inherit;color:rgb(38,38,128)"><a href="http://docs.racket-lang.org/reference/let.html#%28form._%28%28quote._~23~25kernel%29._let-values%29%29" style="text-decoration:none;color:black" target="_blank">let-values</a></span><span style="font-family:monospace"> </span><span style="font-family:monospace;white-space:inherit;color:rgb(132,60,36)">(</span><span style="font-family:monospace;white-space:inherit;color:rgb(132,60,36)">[</span><span style="font-family:monospace;white-space:inherit;color:rgb(132,60,36)">(</span><span style="font-family:monospace;white-space:inherit;color:rgb(38,38,128)">as</span><span style="font-family:monospace"> </span><span style="font-family:monospace;white-space:inherit;color:rgb(38,38,128)">cpu</span><span style="font-family:monospace"> </span><span style="font-family:monospace;white-space:inherit;color:rgb(38,38,128)">real</span><span style="font-family:monospace"> </span><span style="font-family:monospace;white-space:inherit;color:rgb(38,38,128)">gc</span><span style="font-family:monospace;white-space:inherit;color:rgb(132,60,36)">)</span><span style="font-family:monospace"> </span><span style="font-family:monospace;white-space:inherit;color:rgb(132,60,36)">(</span><span style="font-family:monospace;white-space:inherit;color:rgb(38,38,128)"><a href="http://docs.racket-lang.org/reference/time.html#%28def._%28%28quote._~23~25kernel%29._time-apply%29%29" style="text-decoration:none;color:blue" target="_blank">time-apply</a></span><span style="font-family:monospace"> </span><span style="font-family:monospace;white-space:inherit;color:rgb(132,60,36)">(</span><span style="font-family:monospace;white-space:inherit;color:rgb(38,38,128)"><a href="http://docs.racket-lang.org/reference/lambda.html#%28form._%28%28lib._racket%2Fprivate%2Fbase..rkt%29._~ce~bb%29%29" style="text-decoration:none;color:black" target="_blank">λ</a></span><span style="font-family:monospace"> </span><span style="font-family:monospace;white-space:inherit;color:rgb(132,60,36)">(</span><span style="font-family:monospace;white-space:inherit;color:rgb(132,60,36)">)</span><span style="font-family:monospace"> </span><span style="font-family:monospace;white-space:inherit;color:rgb(38,38,128)"><a href="http://docs.racket-lang.org/reference/generic-numbers.html#%28def._%28%28quote._~23~25kernel%29._exp%29%29" style="text-decoration:none;color:blue" target="_blank">exp</a></span><span style="font-family:monospace;white-space:inherit;color:rgb(132,60,36)">)</span><span style="font-family:monospace"> </span><span style="font-family:monospace;white-space:inherit;color:rgb(38,38,128)"><a href="http://docs.racket-lang.org/reference/pairs.html#%28def._%28%28lib._racket%2Flist..rkt%29._empty%29%29" style="text-decoration:none;color:blue" target="_blank">empty</a></span><span style="font-family:monospace;white-space:inherit;color:rgb(132,60,36)">)</span><span style="font-family:monospace;white-space:inherit;color:rgb(132,60,36)">]</span><span style="font-family:monospace;white-space:inherit;color:rgb(132,60,36)">)</span></td>

</tr><tr style="white-space:inherit"><td style="padding-left:0px;padding-right:0px;vertical-align:baseline;white-space:inherit"><span style="font-family:monospace">    </span><span style="font-family:monospace;white-space:inherit;color:rgb(132,60,36)">(</span><span style="font-family:monospace;white-space:inherit;color:rgb(38,38,128)"><a href="http://docs.racket-lang.org/reference/garbagecollection.html#%28def._%28%28quote._~23~25kernel%29._collect-garbage%29%29" style="text-decoration:none;color:blue" target="_blank">collect-garbage</a></span><span style="font-family:monospace;white-space:inherit;color:rgb(132,60,36)">)</span><span style="font-family:monospace"> </span><span style="font-family:monospace;white-space:inherit;color:rgb(132,60,36)">(</span><span style="font-family:monospace;white-space:inherit;color:rgb(38,38,128)"><a href="http://docs.racket-lang.org/reference/garbagecollection.html#%28def._%28%28quote._~23~25kernel%29._collect-garbage%29%29" style="text-decoration:none;color:blue" target="_blank">collect-garbage</a></span><span style="font-family:monospace;white-space:inherit;color:rgb(132,60,36)">)</span><span style="font-family:monospace"> </span><span style="font-family:monospace;white-space:inherit;color:rgb(132,60,36)">(</span><span style="font-family:monospace;white-space:inherit;color:rgb(38,38,128)"><a href="http://docs.racket-lang.org/reference/garbagecollection.html#%28def._%28%28quote._~23~25kernel%29._collect-garbage%29%29" style="text-decoration:none;color:blue" target="_blank">collect-garbage</a></span><span style="font-family:monospace;white-space:inherit;color:rgb(132,60,36)">)</span></td>

</tr></tbody></table><div><br></div><div>Thanks!</div></div><div>---</div><div><div><div style="word-wrap:break-word"><div style="word-wrap:break-word">Vlad Kozin <<a href="mailto:vladilen.kozin@gmail.com" target="_blank">vladilen.kozin@gmail.com</a>><br>

<br><br></div></div>
</div>
<br></div></div><br>____________________<br>
  Racket Users list:<br>
  <a href="http://lists.racket-lang.org/users" target="_blank">http://lists.racket-lang.org/users</a><br>
<br></blockquote></div><br></div>
</blockquote></div><br></div></body></html>