carbon-language / carbon-lang

Carbon Language's main repository: documents, design, implementation, and related tools. (NOTE: Carbon Language is experimental; see README)
http://docs.carbon-lang.dev/
Other
32.24k stars 1.48k forks source link

Collection of minor tweaks to get approx. 10-15% compile time #4245

Closed chandlerc closed 1 month ago

chandlerc commented 1 month ago

Most of these are about enabling inlining, in a couple of cases moving code to a header and throughout switching to CARBON_DCHECK. The code size of CARBON_CHECK seems to make inliing quite unreliable. I'm going to think about whether there are ways to improve this, but a reasonably small number of these seem worth switching for now to get some compile time savings.

Also moves VLOG out of the hot path which helps a bit as well.

All combined, this net a bit over 10%, although it varies a bit exactly how much. We're now pretty consistently over 800k lines/second for check in the compilation benchmark for files >=4k lines, which makes me happy. That's remarkably close to our original target.

Not really planning to keep optimizing here, just was glancing at the profile and many of these stood out to me and were easy to fix.