[LRUG] Recursion diversion

Rosario Rascuna r.rascuna at gmail.com
Sat Oct 26 03:28:13 PDT 2013


Hello,

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.

Here's the challenge (adapted to work on Codersumo, by reading from stdin
and printing to stdout) http://codersumo.com/challenges/16

It's be interesting to see how it can be solved also in other languages
(javascript,clojure or haskell for example)

cheers,
.r




On Sat, Oct 26, 2013 at 9:14 AM, Peter Vandenabeele
<peter at vandenabeele.com>wrote:

> On Sat, Oct 26, 2013 at 9:40 AM, David Nolan <dave at textgoeshere.org.uk>wrote:
>
>> 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):
>> https://gist.github.com/knaveofdiamonds/7155189#comment-936910
>>
>> As an aside, the fruity gem is excellent for benchmarking. This explains
>> why: https://github.com/marcandre/fruity#approach.
>>
>
> Interesting concept indeed.
>
> Also the naive Rspec timing test confirms "dave_spec.rb" to be faster than
> all other contenders
> and fairly memory efficient. I presume the naive Rspec timing test is
> losing relevance, compared
> to more serious Benchmarking tools.
>
> 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)
>
> (ref https://gist.github.com/petervandenabeele/7161464 )
>
> Fun !
>
> Peter
>
> _______________________________________________
> Chat mailing list
> Chat at lists.lrug.org
> http://lists.lrug.org/listinfo.cgi/chat-lrug.org
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lrug.org/pipermail/chat-lrug.org/attachments/20131026/e44af457/attachment.html>


More information about the Chat mailing list