Re: [plt-dev] Re: [plt-scheme] Speed up check-syntax

2009-11-09 Thread Matthew Flatt
Although I previously suggested a low-priority event callback,
`system-idle-evt' seems even better. The `system-idle-evt' function
didn't exist when we implemented syntax coloring as a background task.

Using `system-idle-event' stays out of the way of other GUI events in
the same way as a low-priority callback, and since `system-idle-evt' is
fair (or is supposed to be), multiple background tasks should work
fine, allowing each a turn when no other work is available.

Low-priority callbacks, meanwhile, effectively have a higher priority
than threads blocked on `system-idle-evt'. So, maybe it's good that
syntax coloring uses callbacks, since that will give it a higher
priority than loading cross-reference information.

At Mon, 9 Nov 2009 19:48:16 -0600, Robby Findler wrote:
 I would guess it would be a better fit for GUI interactivity. Use a
 low priority callback to trigger each quantum of work.
 
 Robby
 
 On Monday, November 9, 2009, Eli Barzilay e...@barzilay.org wrote:
  On Nov  9, Robby Findler wrote:
  Thanks, Eli. That looks nice.
 
  Matthew suggested something similar, but using mzlib/couroutine,
  where I use a low-priority gui callback to give the thread the next
  quantum.
 
  Is there any advantage for that?
 
 
  On Nov  9, Robby Findler wrote:
  PS: feel free to check this in, but it probably belongs in
  scribble/xref or setup/xref, not in the syntax checker.
 
  I'll probably put it in `scheme/promise' as some `delay/idle', so it
  works with `force' as usual.
 
  (There is some concern if there are several of these things active --
  if both use the same delay values, then one can starve the other.  But
  I don't think that this is a problem since it's used only for idle
  computations.)
 
  --
            ((lambda (x) (x x)) (lambda (x) (x x)))          Eli Barzilay:
                      http://barzilay.org/                   Maze is Life!
 
 _
   For list-related administrative tasks:
   http://list.cs.brown.edu/mailman/listinfo/plt-dev
_
  For list-related administrative tasks:
  http://list.cs.brown.edu/mailman/listinfo/plt-dev


Re: [plt-dev] Re: [plt-scheme] Speed up check-syntax

2009-11-09 Thread Matthew Flatt
At Mon, 9 Nov 2009 20:51:10 -0500, Eli Barzilay wrote:
 I was concerned that there's some constant gui
 activity that will make the idle timer solution starve, but it doesn't
 look like that's a problem.  (Maybe it will be when more stuff is done
 in Scheme?)

No, there should never be a task that's always running.
_
  For list-related administrative tasks:
  http://list.cs.brown.edu/mailman/listinfo/plt-dev


Re: [plt-dev] Re: [plt-scheme] Speed up check-syntax

2009-11-09 Thread Eli Barzilay
On Nov  9, Matthew Flatt wrote:
 
 Low-priority callbacks, meanwhile, effectively have a higher
 priority than threads blocked on `system-idle-evt'. So, maybe it's
 good that syntax coloring uses callbacks, since that will give it a
 higher priority than loading cross-reference information.

That's what I was fantasizing on previously -- in terms of that
message, low priority callbacks and idle events make two levels.  (And
yes, the idle event as an I really don't care when it runs, just move
it out of the way is something that fits the xref loading well, but
not the colorer.)

BTW, one thing that I don't like about my code is that it first
sleeps, then waits for an idle event.  My first thought was that it
should wait for the system to be idle for some time before it kicks
in.  It's not possible to do this now, right?  (Modulo some ridiculous
busy-wait loop that keeps polling the event.)  Is it possible to add
something that will make it possible?

(In theory there's not much point in doing this if the time slices
that I'm using are smaller than what matters for human interaction,
but when resources like IO are involved, it might make things feel a
little less responsive.)

-- 
  ((lambda (x) (x x)) (lambda (x) (x x)))  Eli Barzilay:
http://barzilay.org/   Maze is Life!
_
  For list-related administrative tasks:
  http://list.cs.brown.edu/mailman/listinfo/plt-dev


Re: [plt-dev] Re: [plt-scheme] Speed up check-syntax

2009-11-09 Thread Jon Rafkind

Eli Barzilay wrote:

On Nov  9, Matthew Flatt wrote:
  

Low-priority callbacks, meanwhile, effectively have a higher
priority than threads blocked on `system-idle-evt'. So, maybe it's
good that syntax coloring uses callbacks, since that will give it a
higher priority than loading cross-reference information.



That's what I was fantasizing on previously -- in terms of that
message, low priority callbacks and idle events make two levels.  (And
yes, the idle event as an I really don't care when it runs, just move
it out of the way is something that fits the xref loading well, but
not the colorer.)

BTW, one thing that I don't like about my code is that it first
sleeps, then waits for an idle event.  My first thought was that it
should wait for the system to be idle for some time before it kicks
in.  It's not possible to do this now, right?  (Modulo some ridiculous
busy-wait loop that keeps polling the event.)  Is it possible to add
something that will make it possible?

  


I noticed there was some new `futures' code in src/mzscheme/future.c. 
Aren't futures exactly whats required here?

(In theory there's not much point in doing this if the time slices
that I'm using are smaller than what matters for human interaction,
but when resources like IO are involved, it might make things feel a
little less responsive.)

  


_
 For list-related administrative tasks:
 http://list.cs.brown.edu/mailman/listinfo/plt-dev