slowness of Cpp::EnvironmentFile::merge

Milian Wolff mail at milianw.de
Wed Dec 22 20:05:26 UTC 2010


On Tuesday 21 December 2010 17:04:21 Milian Wolff wrote:
> Milian Wolff, 21.12.2010:
> > Milian Wolff, 21.12.2010:
> > > Hey all, esp. David:
> > > 
> > > According to this:
> > > https://userpage.physik.fu-berlin.de/~milianw/callgrind.out.4728.bz2
> > > 
> > > the Cpp::EnvironmentFile::merge is responsible for 13.4% of the time
> > > spent parsing a part of boost (duchainify --force-update-recursive
> > > boost_1_45_0/libs/serialization/performance/xml/string256_test.cpp). Is
> > > this sane? I'll redo the callgrind in RelWithDebInfo soon but I hope we
> > > could improve that even now.
> > > 
> > > What I don't quite get are the lines like these:
> > >   d_func_dynamic()->m_strings = (d_func()->m_strings + (file.d_func()-
> > > >
> > > >m_strings - d_func()->m_definedMacroNames)) - d_func()-
> > > >m_unDefinedMacroNames;
> > > 
> > > Won't that lead to duplicated entries? Essentially that is:
> > > 
> > > A = (A + (A - B)) - C
> > > 
> > >   = 2 A - B - C
> > > 
> > > so all items in A not contained in B and C will show up twice (or the
> > > Set is indeed a Set and prevents that internally). Still, this should
> > > be faster and more clear, no?:
> > > 
> > > A -= B;
> > > A -= C;
> > 
> > this doesn't hold though:
> >   ReferenceCountedStringSet strings2 = (d_func()->m_strings +
> > 
> > (file.d_func()-
> > 
> > >m_strings - d_func()->m_definedMacroNames)) - d_func()-
> > >m_unDefinedMacroNames;
> > >
> >   d_func_dynamic()->m_strings -= d_func()->m_definedMacroNames;
> >   d_func_dynamic()->m_strings -= d_func()->m_unDefinedMacroNames;
> >   Q_ASSERT(strings2  == d_func_dynamic()->m_strings);
> > 
> > I wonder why - is the set not a set after all? I.e. can it contain
> > duplicates?
> 
> Ah, there is a file.d_func() in the original, of course it's not the same
> then!

(btw I still want to know whether the performance of this function can be 
improved somehow - 14% of time just for that sounds too much imo).

bye
-- 
Milian Wolff
mail at milianw.de
http://milianw.de
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 198 bytes
Desc: This is a digitally signed message part.
URL: <http://mail.kde.org/pipermail/kdevelop-devel/attachments/20101222/43470341/attachment.sig>


More information about the KDevelop-devel mailing list