inko-lang / inko

A language for building concurrent software with confidence
http://inko-lang.org/
Mozilla Public License 2.0
899 stars 41 forks source link

Figure out which LLVM optimisation passes are worth enabling #595

Open yorickpeterse opened 1 year ago

yorickpeterse commented 1 year ago

Right now the only optimisation pass we enable is the mem2reg pass, because that's pretty much a requirement for non-insane machine code. We deliberately don't use the O2/O3 options as they enable far too many optimisation passes, and don't give you the ability to opt-out of some of them (Swift takes a similar approach).

We should start collecting a list of what passes are worth enabling, and ideally what the compile time cost is versus the runtime improvement. The end goal is to basically enable the passes that give a decent amount of runtime performance improvements, but without slowing down compile times too much.

yorickpeterse commented 1 year ago

From https://github.com/jinyus/related_post_gen/pull/440#issuecomment-1816588961: using OptimizationLevel::Aggressive can have a big impact on the performance compared to None. In itself this isn't surprising, because of course optimizations are beneficial. I however would like to know (somehow) which optimizations are worth enabling, rather than just enabling something as opaque as -O3.

Perhaps as a starting point we can just set that option when using inko build --aggressive, then figure out which ones to explicitly enable for regular builds.

yorickpeterse commented 1 year ago

1a30de95ae23c5fa54a04a535b94bd3c74d60a9c changes inko build such that --opt=aggressive applies the equivalent of clang's -O3. This significantly increases compile times, but it's better than nothing until we come up with our own list of passes to enable.