[Amarok] 7bca886: debug: use elapsed timer
Kevin Funk
krf at gmx.de
Wed Nov 10 12:00:33 CET 2010
Wednesday 10 November 2010, "Rick W. Chen" <stuffcorpse at archlinux.us>:
> On 09 Nov 2010 14:32 +0100, Kevin Funk:
> > Tuesday 09 November 2010, "Rick W. Chen" <stuffcorpse at archlinux.us>:
> > > On 09 Nov 2010 11:47 +0100, Kevin Funk:
> > >
> > > I noticed in Debug_p.h BlockPrivate was defined but not used, so I
> > > thought it was intended to be used later. I've not noticed slower
> > > startup times but yes not using the private ptr stuff could have an
> > > improvement. This only matters if debug is turned on though.
> > >
> > > What's a good way to benchmark this?
> >
> > I'd say: Write a little test case which loops through some specific
> > amount (1000?) of debug() calls in nested functions with DEBUG_BLOCK
> > defined. One time with pimpl idom being used, one time without.
> >
> > You could also add this to Amarok's test suite.
> >
> > Q_BENCHMARK could be useful in this case.
>
> I wrote a simple benchmark [1]. On my machine at least there is
> basically no difference either way. I suspect the string concatenations
> make these trivial, or the benchmark is wrong. The results:
>
> === without pimpl ===
> RESULT : TestDebug::benchDebugBlock():"debug with color":
> 26.3 msecs per iteration (total: 263, iterations: 10)
> RESULT : TestDebug::benchDebugBlock():"debug nocolor":
> 25.6 msecs per iteration (total: 257, iterations: 10)
> RESULT : TestDebug::benchDebugBlock():"nodebug with color":
> 20.8 msecs per iteration (total: 208, iterations: 10)
> RESULT : TestDebug::benchDebugBlock():"nodebug nocolor":
> 20.6 msecs per iteration (total: 206, iterations: 10)
>
> === with pimpl ===
> RESULT : TestDebug::benchDebugBlock():"debug with color":
> 26.6 msecs per iteration (total: 266, iterations: 10)
> RESULT : TestDebug::benchDebugBlock():"debug nocolor":
> 25.8 msecs per iteration (total: 259, iterations: 10)
> RESULT : TestDebug::benchDebugBlock():"nodebug with color":
> 20.3 msecs per iteration (total: 203, iterations: 10)
> RESULT : TestDebug::benchDebugBlock():"nodebug nocolor":
> 21.3 msecs per iteration (total: 214, iterations: 10)
>
> 1.
> http://commits.kde.org/72721c7c/e3842875a4d19affab704dde05121fda2a478d3e
Cool, will have a look at the tests later on.
But good stuff that you wrote a test case for this, thanks Rick.
Good work ;)
--
Kevin Funk
More information about the Amarok-devel
mailing list