this post was submitted on 02 Sep 2025
19 points (100.0% liked)
C++
2101 readers
1 users here now
The center for all discussion and news regarding C++.
Rules
- Respect instance rules.
- Don't be a jerk.
- Please keep all posts related to C++.
founded 2 years ago
MODERATORS
you are viewing a single comment's thread
view the rest of the comments
view the rest of the comments
This is interesting, but drawing conclusions from only two measurements is not reasonable. Especially so when the time-span measured is in the order of a few ms. For example, the two instances of
clang
might not be running at the same clock frequency, which could easily explain away the observed difference.Plus, you could easily generate a very large number of functions, to increase the amount of work the compiler has to do. So I did just that (N = 10,000), using the function from the article, and used hyperfine to perform the actual benchmarking.
int
auto
So if you have a file with 10'000 simple functions with/without
auto
, then it increases your compile time by ~4%.I'd worry more about the readability of
auto
, than about the compile time cost at that point