On Thu, Jul 30, 2009 at 11:46 AM, Colin McQuillan<m.ni...@googlemail.com> wrote:
> vty only provides a blocking getEvent. But at the tty level, it is > possible to see if there is input pending using FIONREAD or just a > non-blocking read. And in gtk there is a call to determine whether > there are still unhanded events. I never knew about that. It seems like an easy win indeed. > The right place to put this might be Yi.Core.dispatch. I had a go, but > found it difficult to avoid refreshing on every event. In a Gtk paste > you know that it's just text and not editor commands, but I didn't see > a nice way to fuse all the events in a paste to vty. It seems like the UI could take care of this simply as: if there is a pending event, skip this refresh. >>> Cursor movement really should be fast enough not to need threading. >>> For me, this is the most frustrating problem. All updates are treated >>> the same and cause a complete refresh. There could be a fast path for >>> updates that only change the display. >> >> I believe that all user input should be treated the same way. Why would a >> delay >> be acceptable on some type of input and not some other? I dislike optimizing >> by breaking into special cases and optimizing each because it increases the >> complexity and the amount of work. I'd rather find optimizations for >> the general case. >> > > I might type a few characters a second, but holding down a cursor key > I get auto-repeat at about twenty events a second. This is just how I > like to scroll through code. If Yi could handle typing at 20 > characters/sec as well that'd be great. I think this is a reasonable goal... > IIRC, Yi.Vty.drawText (which basically takes a string and decides > where each character should go on a 80x24 console) typically takes > more than 50ms. So either it needs to be optimized by memoizing the > layout information, or cursor movements should not cause drawText to > be called. How did you measure this? I'm very surprised that this (relatively simple) function would take so much time. Cheers, JP. --~--~---------~--~----~------------~-------~--~----~ Yi development mailing list yi-devel@googlegroups.com http://groups.google.com/group/yi-devel -~----------~----~----~----~------~----~------~--~---