This is an archive of the discontinued LLVM Phabricator instance.

performance: Prevent needless DWARFCompileUnit::Clear() on freshly ctor-ed object
AbandonedPublic

Authored by jankratochvil on Nov 18 2017, 2:12 PM.

Details

Reviewers
clayborg
labath
Summary

DWARFDebugInfo::ParseCompileUnitHeadersIfNeeded() was clearing each DWARFCompileUnit twice (ctor+Clear()).

Sure I can drop it if it is not worth the change.

Is such patch obvious enough to check it in without an approval?

Diff Detail

Event Timeline

jankratochvil created this revision.Nov 18 2017, 2:12 PM
clayborg requested changes to this revision.Nov 19 2017, 10:21 AM

See inline comments.

source/Plugins/SymbolFile/DWARF/DWARFCompileUnit.cpp
74

Make this static as mentioned in above comment. Assertions are ok to detect things in debug build, but please use lldbassert and make sure it returns an empty shared pointer if things fail (code must function properly when assert is not compiled in the program.

source/Plugins/SymbolFile/DWARF/DWARFCompileUnit.h
34–36

If you want to enforce this, then make this function static and have it return a shared pointer to a DWARFCompileUnit and make the constructor private. Commenting isn't enough on its own

source/Plugins/SymbolFile/DWARF/DWARFDebugInfo.cpp
294–297

I don't see this code in top of tree? My DWARFDebugInfo.cpp ends at line 259

This revision now requires changes to proceed.Nov 19 2017, 10:21 AM

Thanks for the review but then it would become a performance regression, not the performance improvement I was trying to make.
Withdrawing this patch.

source/Plugins/SymbolFile/DWARF/DWARFCompileUnit.cpp
74

In such case each Extract() call will always make a new allocation of DWARFCompileUnit instance which is much more performance expensive that the double in-place reinitialization this patch was trying to avoid.

source/Plugins/SymbolFile/DWARF/DWARFDebugInfo.cpp
294–297
jankratochvil abandoned this revision.Nov 19 2017, 10:47 AM