[racket] Reversing strings (Jay's article)
What values do you get?
For 4'000 strings (old slow computer), I get:
(236 148 84 84)
for slow, medium, fast, really fast, which is consistent with Jay's post.
Laurent
On Wed, Oct 2, 2013 at 7:28 PM, Vlad Kozin <vladilen.kozin at gmail.com> wrote:
> Mostly a question to Jay McCarthy but I suppose could be interesting to
> others. Was going over his Reversing strings<http://jeapostrophe.github.io/2013-08-19-reverse-post.html> article.
> Somehow I get weird performance. Slowest solution turns out fastest,
> medium, fast and really fast are only marginally different.
>
> Could anyone have a look https://github.com/vkz/warm-up
> reverse-string.rkt has the solutions
> test-reverse-string.rkt does the performance check
> Testing it on 40'000 randomly generated strings 1000 chars each.
>
> While we're at it, why do we garbage-collect thrice here?
> let-values<http://docs.racket-lang.org/reference/let.html#%28form._%28%28quote._~23~25kernel%29._let-values%29%29>
> ([(as cpu real gc) (time-apply<http://docs.racket-lang.org/reference/time.html#%28def._%28%28quote._~23~25kernel%29._time-apply%29%29>
> (λ<http://docs.racket-lang.org/reference/lambda.html#%28form._%28%28lib._racket%2Fprivate%2Fbase..rkt%29._~ce~bb%29%29>
> () exp<http://docs.racket-lang.org/reference/generic-numbers.html#%28def._%28%28quote._~23~25kernel%29._exp%29%29>
> ) empty<http://docs.racket-lang.org/reference/pairs.html#%28def._%28%28lib._racket%2Flist..rkt%29._empty%29%29>
> )]) (collect-garbage<http://docs.racket-lang.org/reference/garbagecollection.html#%28def._%28%28quote._~23~25kernel%29._collect-garbage%29%29>
> ) (collect-garbage<http://docs.racket-lang.org/reference/garbagecollection.html#%28def._%28%28quote._~23~25kernel%29._collect-garbage%29%29>
> ) (collect-garbage<http://docs.racket-lang.org/reference/garbagecollection.html#%28def._%28%28quote._~23~25kernel%29._collect-garbage%29%29>
> )
>
> Thanks!
> ---
> Vlad Kozin <vladilen.kozin at gmail.com>
>
>
>
>
> ____________________
> Racket Users list:
> http://lists.racket-lang.org/users
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.racket-lang.org/users/archive/attachments/20131002/23fb45d8/attachment.html>