[racket] Reversing strings (Jay's article)

From: Vlad Kozin (vladilen.kozin at gmail.com)
Date: Thu Oct 3 09:57:00 EDT 2013

Good point! Thank you Robby.

Running in a command line: racket test-reverse-string.rkt
(2459 1638 1006 821)
Difference it makes for the "slow" case is particularly dramatic.

---
Vlad Kozin <vladilen.kozin at gmail.com>



On Oct 2, 2013, at 7:37 PM, Robby Findler wrote:

> I'm not sure what is happening in Geiser, but DrRacket should definitely not be trusted. Here's the relevant section of the docs (feel free to ask more questions if that's not helping):
> 
>   http://docs.racket-lang.org/guide/performance.html
> 
> Robby
> 
> 
> On Wed, Oct 2, 2013 at 6:29 PM, Vlad Kozin <vladilen.kozin at gmail.com> wrote:
> Oh, wow. So I was testing this in Geiser repl in emacs:
> (2467 4631 4088 3934) Where apparently "slower" one wins
> 
> But in DrRacket the result looks plausible:
> (8994 1859 1094 865)
> 
> Does that mean Geiser shouldn't be trusted?
> 
> ---
> Vlad Kozin <vladilen.kozin at gmail.com>
> 
> 
> 
> On Oct 2, 2013, at 1:57 PM, Laurent wrote:
> 
>> 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 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 ([(as cpu real gc) (time-apply (λ () exp) empty)])
>>     (collect-garbage) (collect-garbage) (collect-garbage)
>> 
>> Thanks!
>> ---
>> Vlad Kozin <vladilen.kozin at gmail.com>
>> 
>> 
>> 
>> 
>> ____________________
>>   Racket Users list:
>>   http://lists.racket-lang.org/users
>> 
>> 
> 
> 
> ____________________
>   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/20131003/4a145155/attachment-0001.html>

Posted on the users mailing list.