[RFC] Extending MachO's Balanced Partitioning Feature to ELF

I’m interested in porting the balanced partitioning feature currently implemented for MachO to ELF binaries (as proposed by RFC: Temporal Profiling Extension for IRPGO). This feature has shown promising results for both startup time and compressed size optimization (around 2% improvement in compressed size) on MachO, and I believe ELF binaries, particularly Android applications, could benefit from similar optimizations.

Current Status:

  • Balanced partitioning for startup time and compressed size is currently MachO-specific
  • IRPGO-based function ordering is target-independent and already available
  • The existing implementation has demonstrated ~2% compression improvements

Proposed Work:

  1. Extend the balanced partitioning implementation to support ELF binaries
  2. Implement both compression and startup optimizations simultaneously due to their related nature
  3. Create a unified framework to minimize code duplication between MachO and ELF implementations

I’m looking to collaborate with others interested in this feature. If you’re working on similar optimizations or have experience with ELF binaries, I’d love to hear your thoughts.

7 Likes

I would be happy to see this work implemented for ELF!
It would be nice to minimize code duplication, but I’m not familiar enough with how ELF handles sections to know how feasible this is. We can discuss this in more detail in the PRs.

3 Likes

I’ve just published [lld][ELF] Extend profile guided function ordering to ELF binaries by Colibrow · Pull Request #117514 · llvm/llvm-project · GitHub for review and I’d love to get feedback!

1 Like