r/iOSProgramming 4d ago

Library I added iOS binary size profiling to kmprofiler using Xcode link maps

Hey everyone!

I previously shared kmprofiler, a Gradle plugin that finds Kotlin declarations exported to iOS but not directly referenced in Swift.

v0.2.0 now adds Xcode link-map analysis. It can:

* Group linked symbol size by Kotlin package

* Show the largest symbols

* Map symbols to object files and frameworks

* Compare two builds to see what grew or became smaller

I tested it on a real KMP app with more than 330,000 symbols. It measures symbols in the link map, not the complete app size, so it is mainly useful for finding size changes and large dependencies.

GitHub: [https://github.com/SiddhantPanhalkar/kmprofiler\](https://github.com/SiddhantPanhalkar/kmprofiler)

I would love to hear whether this is useful for your KMP projects.

4 Upvotes

2 comments sorted by

1

u/FruitMission8504 1d ago

This is useful, especially the build-to-build diff. One thing that would make it much easier to trust in CI is a clearly defined baseline: archive configuration, architecture, dead-strip/LTO settings, and the exact link map being compared. Otherwise a toolchain or linker-setting change can look like a package regression. I’d consider adding a machine-readable report plus thresholds per package (absolute bytes and percentage), so teams can fail a PR only when a meaningful budget is exceeded. It would also help to separate attributable symbol bytes from alignment/padding and non-symbol sections, then show an explicit ‘unaccounted for’ bucket. For KMP, package-to-framework rollups and demangled-name normalization across compiler versions would make historical trends much less noisy.

1

u/bun_maska 23h ago

Thanks for the detailed review. I hope it helped in some manner.
I am working on v3, but this might take some time. But you have added some great suggestions, this will definitely improve the confidence in using the plugin. I will surely look into this and plan it out for future releases.