Richard Heck wrote:
Helge Hafting wrote:
Richard Heck wrote:
Helge Hafting wrote:
A really strange test:
I compiled LyX, ran it, and couldn't type fast.
If I press down 10 keyboard keys at the same time, then I get
instant response (10 lowercase letters) in xterm. LyX outputs the
characters one by one! I could type a little faster than LyX writing
"test" over and over, a good touch typist would be much worse off.
This may be the same problem I've been seeing and the root of which,
at least, has now been found. Abdel's working on a fix, I think.
Looks like my problem indeed is a case of "slowness caused by
external selection"
LyX speeds up to normal after a copy+paste inside LyX. It does not
slow down again
if I later select something in an xterm though.
If you remove the "Paste" button from your standard toolbar, it will
solve this problem for now.
Hm - weird.
Note that while the "normal" speed for LyX is fast enough for typing
(even fast typing) it is still not as fast as other apps.
Pressing down 10 or so keys in any other app will display all of them
instantly,
as fast as if they were pasted in. LyX doesn't do that.
You can paste stuff into LyX with great speed, but hit 10 keys and
you'll see
that they appear one by one - even if the speed may be "ok" for a
typist.
The cpu has 100% load if you hit the keyboard repeatedly in this
fashion.
This is because we're updating too many things every time through
dispatch(). For example, the math panel toolbar gets updated---and I
do mean completely updated---every time, even if it is not displayed.
The "even if not displayed" part shouldn't be too hard to fix. The
rest will be harder.
Ouch ouch ouch ouch.
Shouldn't be that hard to fix though.
We should definitely not go around updating toolbars on every keypress.
Instead, check if something changed, and update the bars only then.
For the math this is simple, the only math thing that get disabled is
the "add/delete row/col" things that only works inside a matrix.
So the fix is: On every keypress, figure out if we're inside a
matrix or not. Compare to the previous status - update the math
toolbar only if this the new status is different from the new. Similiar
for other things we update.
Or do the same thing on a different level.
Call into the update-stuff as before, but each such update
function should remember the previous state, and only
update its toolbar or dialog content or whatever) if there were a change.
This should save lots of painting.
It is harder if this testing alone cause too much work though.
Helge Hafting