Logging in debug and release builds
Alex Bligh
alex at alex.org.uk
Thu Aug 10 08:01:57 PDT 2006
Vadim Zeitlin wrote:
> On Thu, 10 Aug 2006 14:12:56 +0200 Marius Kjeldahl <marius at kjeldahl.net> wrote:
>
> MK> When building for debug mode a lot of the work is typically formatting
> MK> data structures for string output, and for tight loops this quickly
> MK> becomes more work than the rest of the loop usually processes, and will
> MK> cause it to run a lot slower than it should.
>
> I find it surprising that the compiler doesn't optimize the code away. I
> thought that any optimizing compiler, even really bad one, would be able to
> inline an empty inline function and then do the dead code elimination. Of
> course, as I also know that you shouldn't suppose anything about compilers
> as their ways are often impenetrable to common sense, I distinctly remember
> testing it with VC6 and I could see that, indeed, it eliminated all unused
> code in the release build.
Didn't he say he is building for debug mode? In which case optimization
is turned off.
Whatever, wxLogDebug is REALLY slow. It's especially slow when feeding
into kdevelop. I'd assumed (without checking) that this was down to the
number of flush() requests on the stream, as kdevelop causes a repaint
for each one. Clearly flush() is useful in that if the program crashes,
you get all the debug output, but...
Alex
More information about the wx-users
mailing list