News for hackers. Stuff that matters.
Re:"Why is the Rust compiler so slow?" by treyd on Thursday June 26, 2025 @07:44PM (#44392553)
Not only does it generate more code, the initially generated code before optimizations is also often worse. For example, heavy use of iterators means a ton of generics being instantiated and a ton of call code for setting up and tearing down call frames. This gets heavily inlined and flattened out, so in the end it's extremely well-optimized, but it's a lot of work for the compiler. Writing it all out classically with for loops and ifs is possible, but it's harder to read.
Re:"Why is the Rust compiler so slow?" by estebank on Friday June 27, 2025 @10:29AM (#44397082)
For loops are sugar around an Iterator instantiation:

  for i in 0..10 {}
translates to roughly

  let mut iter = Range { start: 0, end: 10 }.into_iter();
  while let Some(i) = iter.next() {}