Abdelrazak Younes wrote:
I know but I was talking about this other debug info at line 240 of QLPainter that is also using PAINTING:

if (isDrawingEnabled()) {
    lyxerr[Debug::PAINTING] << "draw " << std::string(str.toUtf8())
        << " at " << x << "," << y << std::endl;
    drawText(x, y, str);
}

So I think I am right there... Well at least for 1.5.

I just got rid of that one as well. This one is particularly expensive: 2 memory allocations involved. I know that I originally wrote that line for debugging, but it was never meant to be committed as you did in 15723. Sorry for not being clear about that.

This was my initial idea also but I am not sure if this is useful because is the test is done in any case in the lyxerr << operator. More exactly this test is done at line 97 of debugstream.h:

    std::basic_ostream<charT, traits> & operator[](Type t) {
        if (debug::match(dt, t))
            return *this;
        return nullstream;

I guess that's what the person who wrote debugstream thought. "This is probably good enough." But that person forgot to have a look at nullstream. It is a piece of absolute crap.

So it boils down to a very simple message for all coders here:

     ** Don't use lyxerr[] in a critical code path. ***

I have said this many times. I guess I should try all caps:

      ************************************************
      ** lyxerr[] IS **ALWAYS** EXPENSIVE LIKE HELL **
      ************************************************

Regards,
Asger

Reply via email to