std.d.lexer requirements

Jacob Carlborg doob at me.com
Thu Aug 2 23:33:47 PDT 2012


On 2012-08-03 00:10, Walter Bright wrote:

> The rendering code should be in yet a third thread.

Most GUI systems are not thread safe. I know for sure that Cocoa on Mac 
OS X is not. All the changes to the GUI needs to happen in the same 
thread. But you can usually post a message from another thread to the 
GUI thread if you want to update the GUI from another thread.

> An editor I wrote years ago had the rendering code in a separate thread
> from user input. You never had to wait to type in commands, the
> rendering would catch up when it could. What was also effective was the
> rendering would abandon a render midstream and restart it if it detected
> that the underlying data had changed in the meantime. This meant that
> the display was never more than one render out of date.
>
> Although the code itself wasn't any faster, it certainly *felt* faster
> with this approach. It made for crisp editing even on a pig slow machine.

But if you type something and you don't see any new characters that will 
feel slow. Regardless of the application received the user input or not. 
The user doesn't care what's happening in the background of the 
application, it only cares about what it can see.

I've used many editors/IDEs where the GUI locks, for whatever reason, 
you continue typing and suddenly you get 5 characters at once. To me, 
that would indicate the the application do receive the user input but it 
cannot render it fast enough, for whatever reason.

-- 
/Jacob Carlborg


More information about the Digitalmars-d mailing list