2009/7/30 Jean-Philippe Bernardy <jeanphilippe.berna...@gmail.com>: > > On Thu, Jul 30, 2009 at 10:13 AM, Colin McQuillan<m.ni...@googlemail.com> > wrote: > >> What operation will asynchronous rendering make faster? > > There are two operations that are costly: (supposedly) > 1. Computing the information to show the user (ui-independent) > 2. Putting that information on the screen (ui-dependent) > > The idea is to pipeline this process: stage 2 for iteration n can be > run in parallel > to stage 1 for iteration (n+1). > >> Pasting to the >> Pango frontend is already fast because we insert all the characters at >> once. Pasting to the vty frontend could be improved by only redrawing >> when there is no more tty input. > > There is no way to predict when input will stop. So the only option is to > place > a delay on the redraw. Maybe a delay of 0.01s could be acceptable? >
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. Using a channel with a 0.01s delay would probably be fine though. 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. >> 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. 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. --~--~---------~--~----~------------~-------~--~----~ Yi development mailing list yi-devel@googlegroups.com http://groups.google.com/group/yi-devel -~----------~----~----~----~------~----~------~--~---