<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On 22 February 2013 21:18, Sam Tobin-Hochstadt <span dir="ltr"><<a href="mailto:samth@ccs.neu.edu" target="_blank">samth@ccs.neu.edu</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div>On Fri, Feb 22, 2013 at 4:51 AM, Haiwei Zhou <<a href="mailto:highfly22@gmail.com" target="_blank">highfly22@gmail.com</a>> wrote:<br>
> Hi,<br>
><br>
> I wrote a simple script for fannkuch redux.<br>
> <a href="https://github.com/highfly22/fannkuch-redux/blob/master/fannkuch-redux.rkt" target="_blank">https://github.com/highfly22/fannkuch-redux/blob/master/fannkuch-redux.rkt</a><br>
><br>
> The result of this script is about 10 minutes in my i7 machine, which is<br>
> better than Python, lua and ruby. Is the result expected? Do I miss<br>
> something?<br>
<br>
</div>That seems reasonable, and if you're getting the right answers, I<br>
wouldn't worry.<br>
<div><br>
> I have tried to use unsafe op. That may reduces about 30 seconds.<br>
<br>
</div>Which unsafe operations? Vectors, fixnums, both?<br></blockquote><div>Only for vectors. This algorithm uses vector operations heavily. <br></div><blockquote class="gmail_quote" style="margin:0pt 0pt 0pt 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<div><br>
> The optimizer couch complains the missed inline on the most time spent<br>
> functions - flip and flip-count. I tried to re-write the functions to<br>
> macros. But it doesn't change anything.<br>
><br>
> I also tried to re-write in the typed/racket. It doesn't help either.<br>
<br>
</div>I'd be interested in seeing the typed version -- maybe we can give it<br>
more restricted types that help the optimizer more.<br></blockquote><div> The typed version doesn't work well as I expected. I guess unsafe operations does the same thing.<br></div><blockquote class="gmail_quote" style="margin:0pt 0pt 0pt 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<div><br>
> Finally, I try to use future. There is not a blocking operation in the<br>
> future-visualizer. But it's twice slow than normal version. Maybe task (each<br>
> flip-count) is too trivial for this job.<br>
<br>
</div>I'm sure that James would love to see the version with futures, but I<br>
find that futures work best if you don't create too many of them. How<br>
many times does `flip-count` get run?<br></blockquote><div>For n = 7, flip-count got run 5039 times (7! - 1). <br></div><blockquote class="gmail_quote" style="margin:0pt 0pt 0pt 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<span><font color="#888888">
Sam<br>
</font></span></blockquote></div><br></div></div>