Skip to content
This repository has been archived by the owner on Apr 4, 2022. It is now read-only.

Duplication In Real World Projects

Russell Gallop edited this page Feb 19, 2019 · 11 revisions

COMDAT duplication

The following charts show the number of duplicated COMDAT instances found in the object files for large, real-world, C++ projects. In each case, the projects' object files were scanned to discover the set of COMDAT instances. These were then matched according to the normal rules followed by the static linker. For each name, the number of instances generated by the compiler and discarded by the linker was counted. The size of each instance is captured to give an indication of the compile-time cost of the code-generation cost.

Title No. Instances Generated No. Instances Discarded Discarded (%)
Chromium 577397 576223 99.80
Clang+LLVM 3.7 52554 51766 98.50

In the charts below, each point represents a COMDAT group. The position on the x-axis is the number of bytes in the largest instance (this is a very rough approximation of the time taken to produce the group). The y-axis position is given by the number of instances of this group that were encountered in the object files. In an ideal system, each group should be generated only once (any further instances represent time wasted by the compiler since they will be discarded by the linker). The further to the top-right corner of the chart, the greater the likely impact on the build time.

LLVM

LLVM

Chrome

Chrome