[racket] The performance of fannkuch-redux
On Fri, Feb 22, 2013 at 4:51 AM, Haiwei Zhou <highfly22 at gmail.com> wrote:
> Hi,
>
> I wrote a simple script for fannkuch redux.
> https://github.com/highfly22/fannkuch-redux/blob/master/fannkuch-redux.rkt
>
> The result of this script is about 10 minutes in my i7 machine, which is
> better than Python, lua and ruby. Is the result expected? Do I miss
> something?
That seems reasonable, and if you're getting the right answers, I
wouldn't worry.
> I have tried to use unsafe op. That may reduces about 30 seconds.
Which unsafe operations? Vectors, fixnums, both?
> The optimizer couch complains the missed inline on the most time spent
> functions - flip and flip-count. I tried to re-write the functions to
> macros. But it doesn't change anything.
>
> I also tried to re-write in the typed/racket. It doesn't help either.
I'd be interested in seeing the typed version -- maybe we can give it
more restricted types that help the optimizer more.
> Finally, I try to use future. There is not a blocking operation in the
> future-visualizer. But it's twice slow than normal version. Maybe task (each
> flip-count) is too trivial for this job.
I'm sure that James would love to see the version with futures, but I
find that futures work best if you don't create too many of them. How
many times does `flip-count` get run?
Sam