<div dir="ltr">Hello,<div><br></div><div>Interesting puzzle! I've added it to a side project of mine called Codersumo. It's still in its infancy and it doesn't provide benchmarks, however it has a web interface and support a dozen programming languages.</div>

<div><br></div><div>Here's the challenge (adapted to work on Codersumo, by reading from stdin and printing to stdout) <a href="http://codersumo.com/challenges/16">http://codersumo.com/challenges/16</a></div><div><br>
</div>
<div>It's be interesting to see how it can be solved also in other languages (javascript,clojure or haskell for example)</div><div><br></div><div>cheers,</div><div>.r</div><div><br></div><div><br></div></div><div class="gmail_extra">

<br><br><div class="gmail_quote">On Sat, Oct 26, 2013 at 9:14 AM, Peter Vandenabeele <span dir="ltr"><<a href="mailto:peter@vandenabeele.com" target="_blank">peter@vandenabeele.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">

<div dir="ltr"><div class="im">On Sat, Oct 26, 2013 at 9:40 AM, David Nolan <span dir="ltr"><<a href="mailto:dave@textgoeshere.org.uk" target="_blank">dave@textgoeshere.org.uk</a>></span> wrote:<br></div><div class="gmail_extra">

<div class="gmail_quote"><div class="im">
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div><span style="background-color:rgb(251,251,251);color:rgb(51,51,51);font-family:Helvetica,arial,freesans,clean,sans-serif;font-size:13px;line-height:22px">With a bit of memoization, this one runs pretty fast (2+ times faster than the next fastest on haystacks > 100 chars and needles > 4 chars, and increasingly much better as the strings get larger): </span><a href="https://gist.github.com/knaveofdiamonds/7155189#comment-936910" target="_blank">https://gist.github.com/knaveofdiamonds/7155189#comment-936910</a></div>




<div><div><br></div><div>As an aside, the fruity gem is excellent for benchmarking. This explains why: <a href="https://github.com/marcandre/fruity#approach" target="_blank">https://github.com/marcandre/fruity#approach</a>.</div>


</div></div></blockquote><div><br></div></div><div>Interesting concept indeed.<br><br></div><div>Also the naive Rspec timing test confirms "dave_spec.rb" to be faster than all other contenders<br></div><div>and fairly memory efficient. I presume the naive Rspec timing test is losing relevance, compared<br>


to more serious Benchmarking tools.<br><br><pre><code>roland_spec.rb  =>   9.14 s  11 loc (1035 MB max RSIZE)
michael_spec.rb =>   8.82 s  13 loc (1044 MB max RSIZE)
peter_spec.rb   =>   5.91 s  30 loc ( 244 MB max RSIZE)
tom_spec.rb     =>  20.05 s   9 loc ( 326 MB max RSIZE)
dominic_spec.rb => 395.   s  14 loc ( 434 MB max RSIZE)
jason_spec.rb   =>  16.21 s  19 loc ( 535 MB max RSIZE)
peter2_spec.rb  =>   5.24 s  42 loc ( 222 MB max RSIZE)
dave_spec.rb    =>   4.82 s  19 loc ( 323 MB max RSIZE) </code></pre>(ref <a href="https://gist.github.com/petervandenabeele/7161464" target="_blank">https://gist.github.com/petervandenabeele/7161464</a> )<br></div><div>

<br>Fun !<span class="HOEnZb"><font color="#888888"><br>
<br></font></span></div><span class="HOEnZb"><font color="#888888"><div>Peter<br></div></font></span></div></div></div>
<br>_______________________________________________<br>
Chat mailing list<br>
<a href="mailto:Chat@lists.lrug.org">Chat@lists.lrug.org</a><br>
<a href="http://lists.lrug.org/listinfo.cgi/chat-lrug.org" target="_blank">http://lists.lrug.org/listinfo.cgi/chat-lrug.org</a><br>
<br></blockquote></div><br></div>