Compile Time Improvements

Open
#2,894 1 comment 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 2 days

Nobody has claimed this yet.

  • #3066 by @AbhishekkSaini — closed without merging

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
30/100
Issue type
Refactor
Clarity
Mostly clear
Activity status
Stale
Tech stack
cmake, cpp

Research direction

Start by inspecting src/CmakeLists.txt and measuring the source compile times during parallel unity builds. Check how MSVC-generated projects set the language standard, then confirm that the sources are ordered by compile time and those projects specify C++17.

Written by the indexing model from the issue text.

Description

Description
Sort the sources in the src/CmakeLists.txt by compile times. When doing parallel builds in conjunction with unity builds it makes sense to have the biggest sources first.

Additional context
When building the lib, msvc generated projects should specify c++17. This is because, for c++20 msvc does a prepass search for module dependencies but this can double the compile times and it doesn't need to do this.

If we were really serious about improving compile times...
Instead of just compiling all files individually or using cmake's unity build generated files, I would create 4 source files that included the actual sources. This would allow maintainers to distribute the sources so that each custom source file would compile in roughly the same time. And the reason to use 4 source files is coz most people have at least 4 threads.

Dominant language
C++
Stars
21.6k
Forks
3.4k
Avg merge
3d 12h
Merged PRs (30d)
5

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from catchorg/Catch2

All issues in catchorg/Catch2

Similar issues

More C++ issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.