[LRUG] Recursion diversion
Peter Vandenabeele
peter at vandenabeele.com
Sat Oct 26 01:14:23 PDT 2013
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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lrug.org/pipermail/chat-lrug.org/attachments/20131026/093ab4bc/attachment-0003.html>
More information about the Chat
mailing list