here, I think xos_main::xos_app_util::... is the first line that is code I am directly writing. Given the other code is "out of my control", is trying to optimize this hopeless? I don't understand what's happening with all the Rc / Box.
Pointing out the obvious, it means you use a lot of Rcs, NonNulls, and Boxes.
The compiler monomorphises generic structs/functions, so if you monomorphised Rc<T>::new() is accounting for a large amount of LLVM IR that means,
You are calling Rc::new() with lots of different types - this often accidentally happens when you use Rc in generics so maybe using trait objects instead of generics will reduce the amount of monomorphised copies your binary has, or
Your program contains so little code that seemingly trivial functions like Rc::new() and box_free take up a large amount of codegen time
Don't forget that those copies of Rc::new() and friends only exist because your code calls them at some point (possibly via a transitive dependency). So it's completely within you control.
Turns out you're right, I can control how much Rc is used. (In fact, close to 0 now I think). Nevertheless, after reducing llvm-lines from 40k to 20k, compile time only went from 2.5s to 2.1s for the crate. (this is only release mode, opt-level = 3)
Is there anything besides llvm-lines worth looking into? (while keeping opt-level = 3)