I collect garbage three times to find finalized resources and free them. I
don't know if this is always necessary or if 3 is the right number, but I
learned to do it long ago and do it by habit.

Jay


On Wed, Oct 2, 2013 at 11:28 AM, Vlad Kozin <vladilen.ko...@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.ko...@gmail.com>
>
>
>
>
> ____________________
>   Racket Users list:
>   http://lists.racket-lang.org/users
>
>


-- 
Jay McCarthy <j...@cs.byu.edu>
Assistant Professor / Brigham Young University
http://faculty.cs.byu.edu/~jay

"The glory of God is Intelligence" - D&C 93
____________________
  Racket Users list:
  http://lists.racket-lang.org/users

Reply via email to