Description of the project: While the primary job of a compiler is to produce fast code (good run-time performance), it is also important that optimization doesn’t take too much time (good compile-time performance). The goal of this project is to improve compile-time without hurting optimization quality.
The general approach to this project is:
- Pick a workload to optimize. For example, this could be a file from CTMark compiled in a certain build configuration (e.g.
-O0 -g
or-O3 -flto=thin
). - Collect profiling information. This could involve compiler options like
-ftime-report
or-ftime-trace
for a high-level overview, as well asperf record
orvalgrind --tool=callgrind
for a detailed profile. - Identify places that are unexpectedly slow. This is heavily workload dependent.
- Try to optimize an identified hotspot, ideally without impacting generated code. The compile-time tracker can be used to quickly evaluate impact on CTMark.
As a disclaimer, it should be noted that outside of pathological cases, compilation doesn’t tend to have a convenient hotspot where 90% of the time is spent, instead it is spread out across many passes. As such, individual improvements also tend to have only small impact on overall compile-time. Expect to do 10 improvements of 0.2% each, rather than one improvement of 2%.
Expected results: Substantial improvements on some individual files (multiple percent), and a small improvement on overall geomean compile-time.
Desirable skills: Intermediate C++. Familiarity with profiling tools (especially if you are not on Linux, in which case I won’t be able to help).
Project size: Either medium or large.
Difficulty: Medium
Confirmed Mentor: @nikic