Martin Vermeer wrote: >> Attached are edited highlights from this profiling. There would >> appear to be lots of scope for improvement :) >> >> Assuming that I'm editing the right bit of the profile log of >> course...
> I think it is. And it is precisely the things my patch addresses... > BufferView-pimpl-update, lyxtext-redoParagraph, screen-redraw and > all that stuff. Linking here takes over an hour with Debian unstable's gcc 4.0.2, ld 2.16, so I'm not really in a position to do too much experimentation. However, there's no reason why you couldn't generate a similar profiling executable using the configure command that I posted. Presumably, linking times for you will be much shorter if you're using gcc < 4. Given Helge's reports on improved behaviour with your patch, I'd anticipate that it, or something like it, will go into the tree soon. Thereafter, I'll generate a new executable and post a new report if nobody beats me to it. > Except > QContentPane::keyeventTimeout() > which we should still look at separately then: > // Restart the timer. > step_timer_.start(25, true); > If this is the timer in milliseconds, perhaps we should see what > happens if we raise it to 50. int QTimer::start ( int msec, bool sshot = FALSE ) Starts the timer with a msec milliseconds timeout, and returns the ID of the timer, or zero when starting the timer failed. If sshot is TRUE, the timer will be activated only once; otherwise it will continue until it is stopped. Any pending timer will be stopped. Anyway, "cvs annotate" is blaming you for this code :) 1.35 (vermeer 06-Jun-05): 1.35 (vermeer 06-Jun-05): // Start the timer, one-shot. 1.35 (vermeer 06-Jun-05): step_timer_.start(25, true); Diff to previous 1.34 Lars's key input queue RCS file: /home/lyx/cvs/lyx-devel/src/frontends/qt2/QContentPane.C,v retrieving revision 1.34 retrieving revision 1.35 diff -u -r1.34 -r1.35 --- lyx-devel/src/frontends/qt2/QContentPane.C 2005/06/03 09:25:46 1.34 +++ lyx-devel/src/frontends/qt2/QContentPane.C 2005/06/06 12:34:28 1.35 @@ -19,7 +19,6 @@ #include <qapplication.h> #include <qpainter.h> -#include <qtimer.h> #include <boost/bind.hpp> @@ -90,6 +89,8 @@ boost::bind(&QContentPane::generateSyntheticMouseEvent, this)); + connect(&step_timer_, SIGNAL(timeout()), SLOT(keyeventTimeout())); + setFocusPolicy(QWidget::WheelFocus); setFocus(); setCursor(ibeamCursor); @@ -101,6 +102,9 @@ // stupid moc strikes again connect(wa_->scrollbar_, SIGNAL(valueChanged(int)), this, SLOT(scrollBarChanged(int))); + + // Start the timer, one-shot. + step_timer_.start(25, true); } @@ -251,9 +255,35 @@ void QContentPane::keyPressEvent(QKeyEvent * e) { + keyeventQueue_.push(boost::shared_ptr<QKeyEvent>(new QKeyEvent(*e))); +} + + +void QContentPane::keyeventTimeout() +{ + bool handle_autos = true; + + while (!keyeventQueue_.empty()) { + boost::shared_ptr<QKeyEvent> ev = keyeventQueue_.front(); + + // We never handle more than one auto repeated + // char in a list of queued up events. + if (!handle_autos && ev->isAutoRepeat()) { + keyeventQueue_.pop(); + continue; + } + boost::shared_ptr<QLyXKeySym> sym(new QLyXKeySym); - sym->set(e); - wa_->workAreaKeyPress(sym, q_key_state(e->state())); + sym->set(ev.get()); + + wa_->workAreaKeyPress(sym, q_key_state(ev->state())); + keyeventQueue_.pop(); + + handle_autos = false; + } + + // Restart the timer. + step_timer_.start(25, true); } -- Angus