Skip to content

libphobos.a section audit: largest contributors to binary size #10970

@morningstarxcdcode

Description

@morningstarxcdcode

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions