Subject: Re: POW: speed up bulk spell checking
From: Ben Mesman (b.mesman@snow.nl)
Date: Thu Aug 30 2001 - 05:54:58 CDT
>
> For the record, AFAIK, win32 has no analogue to gtk_idle_add. But you
> can use a fancier event loop:
>
> while (1) {
> PeekMessage(...); // extract msg from queue if avail, nonblocking
> if (got msg) {
> dispatch it
> } else {
> if (have idle function) {
> cont = true
> while (cont) {
> cont = idle();
> }
> }
> GetMessage(...); // extract msg from queue, blocking
> }
> }
This may be a good way to implement this on win32, but I can't
implement this, because I don't have a win32 platform. Look good, but
shouldn't the 'GetMessage()' be in an 'else' part of the 'if (have
idle function)'?
> It calls the idle function when idle. It doesn't use 100% cpu when the
> idle function has no work to do. Can this work in gtk?
This could also work in gtk, but it is not realy neccessary. The only
way AW will take 100% cpu, is when there is a function in the idle
queue that immediately returns, because it has nothing to do. If we do
a proper job of timer/idle-queue mainenance, this will not be a
problem. In the case of spell chacking, this is quite easy, if the
(dirty-)blockcount reaches zero, we stop the UT_Timer (i.e. remove the
_backgroundCheck() from the idle queue). When a block is added, we
already check if the timer is set (and started).
Cheers,
Ben.
-- Ben Mesman Snow b.v. - Unix consultants & OO developers The Amazing Snowmen Produktgroep Open Source
This archive was generated by hypermail 2b25 : Thu Aug 30 2001 - 05:55:12 CDT