Summary
I ran objdump on libphobos.a and sorted all sections by size to identify
the largest contributors. This was done as part of a performance research
prototype for GSoC 2026.
Method
objdump -h libphobos.a | awk '/[0-9a-f]{8} [0-9a-f]{8}/ {print $3, $2}' \
| sort -rh | head -30
Finding
Template instantiations in std.algorithm and std.range dominate section
sizes. There are multiple near-duplicate instantiation symbols that suggest
redundant template expansion — the linker is not deduplicating them.
Question
Is there an existing effort to reduce template bloat in Phobos?
Is pragma(inline, true) + explicit instantiation the recommended approach,
or is there a better pattern being considered?
I can share the full sorted section dump if useful.
Summary
I ran
objdumponlibphobos.aand sorted all sections by size to identifythe largest contributors. This was done as part of a performance research
prototype for GSoC 2026.
Method
Finding
Template instantiations in
std.algorithmandstd.rangedominate sectionsizes. There are multiple near-duplicate instantiation symbols that suggest
redundant template expansion — the linker is not deduplicating them.
Question
Is there an existing effort to reduce template bloat in Phobos?
Is
pragma(inline, true)+ explicit instantiation the recommended approach,or is there a better pattern being considered?
I can share the full sorted section dump if useful.