On Sat, Sep 29, 2007 at 11:27:56AM -0400, Richard Heck wrote:
> Abdelrazak Younes wrote:
> >I can't reproduce the selection problem (because I'm not on X11) but 
> >could you please apply this patch and report if the slowness problem 
> >still persist?
> Unfortunately, that did not help. But here are some more things I've 
> found out.
> 
> First, the slowness is coming during the update of the standard toolbar, 
> in particular, during the update of the PASTE button, and more precisely 
> during the getStatus() call, and yet more precisely, during the 
> theClipboard().empty() check. So I did this:
> bool GuiClipboard::empty() const
> {
>    // We need to check both the plaintext and the LyX version of the
>    // clipboard. The plaintext version is empty if the LyX version
>    // contains only one inset, and the LyX version is empry if the
>    // clipboard does not come from LyX.
>    QTime t = QTime::currentTime();
>    bool b = !qApp->clipboard()->text(QClipboard::Clipboard).isEmpty();
>    lyxerr << "Checking emptiness took " << t.restart() << std::endl;
>    if (b)
>        return false;
>    return !hasLyXContents();
> }
> and I'm getting times on the order of 125ms just for that one call.

I remember sending at least two messages to the list saying that calling
QClipboard::text() is an extremely expensive operation and should be
avoided.

Instead, user code should hook to the QClipoard::*changed() signals
and cache the results.

> Second, every toolbar is updated every time through here EVEN IF IT IS 
> NOT DISPLAYED. I found this out because hiding the standard toolbar made 
> no difference. This is a waste.

Welcome in my world.

Andre'

Reply via email to