news.volyx.in

Thoughts on Rust bloat (raphlinus.github.io)

443 points by xenocratus · 2615 days ago · 305 comments on HN

Article summary

The article discusses the issue of bloat in the Rust ecosystem, particularly in regards to compile times and executable size. The author notes that while some features, such as localization and Unicode support, are important, they can also contribute to bloat. The article suggests various strategies for mitigating bloat, including using dynamic dispatch, pregenerating data, and profiling code. The author also emphasizes the importance of measuring and tracking performance metrics, such as compile time and binary size, to identify areas for improvement.

Main themes

  • Rust bloat
  • compile times
  • executable size
  • performance optimization
  • language design
  • trade-offs

What commenters say

  • Using polymorphism and async code can lead to increased bloat, and should be used judiciously.
  • Dynamic dispatch can be a viable alternative to monomorphization for reducing bloat, but may come with performance costs.
  • Inlining code can have negative performance implications in large systems due to instruction cache effects.
  • The Rust compiler's aggressive inlining heuristic can sometimes lead to increased binary size and decreased performance.
  • Measuring and optimizing for performance metrics, such as compile time and binary size, is crucial for maintaining a healthy and efficient Rust ecosystem.
  • Some developers argue that the benefits of using certain features, such as serde, outweigh the costs of increased bloat.
  • Others propose using conditional builds or proc macros to optimize code for different use cases and reduce bloat.