That fixed it. It is still a bit slower but it is now much closer and good enough for me.<div>(0.945068359375 1.10400390625 0.961181640625)<br></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Fri, Dec 14, 2012 at 5:28 AM, Matthew Flatt <span dir="ltr"><<a href="mailto:mflatt@cs.utah.edu" target="_blank">mflatt@cs.utah.edu</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="im">At Thu, 13 Dec 2012 22:57:54 -0800, Eric Dobson wrote:<br>
> I have a program which is thread 'heavy' and runs much slower in embedded<br>
</div>> racket (vim) than it does in pure racket. [...]<br>
<div class="im">><br>
> If I don't do in in a separate thread, then vim is comparable because it is<br>
> using the racket scheduler, and not calling scheme_check_threads. Vim calls<br>
> scheme_check_threads every bit (I think 10 times a second), but it looks<br>
> like not much progress is made on each of these steps. I can understand if<br>
> it was slightly slower, but a factor of over 50k is a bit too much. Is it<br>
> possible for scheme_check_threads to do more work on each invocation in a<br>
> scenario like this?<br>
<br>
</div>Yes, I think it would make sense for scheme_check_threads() to loop<br>
with its current body until either one thread quantum (10ms) has passed<br>
or check_sleep() returns 1 to indicate that no threads are ready to<br>
run.<br>
<br>
Does the variant below help?<br>
<br>
----------------------------------------<br>
<br>
void scheme_check_threads(void)<br>
{<br>
double start, now;<br>
<br>
start = scheme_get_inexact_milliseconds();<br>
<br>
while (1) {<br>
scheme_current_thread->suspend_break++;<br>
scheme_thread_block((float)0);<br>
--scheme_current_thread->suspend_break;<br>
<br>
if (check_sleep(have_activity, 0))<br>
break;<br>
<br>
now = scheme_get_inexact_milliseconds();<br>
if (((now - start) * 1000) > MZ_THREAD_QUANTUM_USEC)<br>
break;<br>
}<br>
}<br>
<br>
</blockquote></div><br></div>