This is an archive of the discontinued LLVM Phabricator instance.

[CodeView] Speed up type iteration
ClosedPublic

Authored by zturner on Jan 16 2018, 4:42 PM.

Details

Summary

The abstractions in use for iterating over sequences of types are apparently slow. This is not easy to fix, but it basically boils down to abstraction overhead. The internal abstractions have several layers of pointer indirections and shared_ptr copies, which slows things down considerably considering this is in the hot path.

Going back to raw byte-level constructs speeds this up rather significantly, on the order of 10%-15% of total link time. The particular test case here went from 41.6s (pre-patch) to 36s (post-patch), for a solid 15% improvement.

Diff Detail

Event Timeline

zturner created this revision.Jan 16 2018, 4:42 PM
ruiu added a subscriber: ruiu.Jan 16 2018, 4:46 PM
ruiu added inline comments.
llvm/lib/DebugInfo/CodeView/TypeStreamMerger.cpp
353–355

nit: you can directly return a return value of forEachCodeViewRecord.

rnk added inline comments.Jan 16 2018, 5:18 PM
llvm/include/llvm/DebugInfo/CodeView/CVRecord.h
67

This needs to be bounds checked. That's why we came up with that consumeObject pattern, right?

This revision was not accepted when it landed; it landed in state Needs Review.Jan 18 2018, 10:37 AM
This revision was automatically updated to reflect the committed changes.