slowness of Cpp::EnvironmentFile::merge
Milian Wolff
mail at milianw.de
Tue Dec 21 15:58:49 UTC 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?
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/20101221/61a2373c/attachment-0001.sig>
More information about the KDevelop-devel
mailing list