C++ Logo

std-proposals

Advanced search

Re: [std-proposals] Extension to std::tuples to allow runtime indexing.

From: Thiago Macieira <thiago_at_[hidden]>
Date: Fri, 17 Apr 2026 08:46:04 -0700
On Friday, 17 April 2026 06:37:32 Pacific Daylight Time Muneem via Std-
Proposals wrote:
> 1. I am not stating that book keeping is obligatory, but rather the
> implementation has that choice to make, and as we know the implementation
> knows more than us.

That is not always true. And that is in particular not true for the cases
you're making. You're talking about highly-optimised and performance-critical
code, depending on minute architectural and microarchitectural details of the
target systems. The compiler *will* *not* *know* enough about this, even if
you passed all the right -march= flags. In theory, it could know; in practice,
it does not today and will not for the next decade at least. I don't think
even Profile-Guided Optimisation will do enough for the cases we're discussing.

The point is that the compiler is good at generalising. You're talking about
hyper-optimisation for one particular use-case for one particular target.

I *have* participated in optimisation discussions for software that was
underperforming in our hardware versus the competition and I can tell you that
the reasons were not details the compilers (today) know about. They were also
not data structure problems.

-- 
Thiago Macieira - thiago (AT) macieira.info - thiago (AT) kde.org
  Principal Engineer - Intel Data Center - Platform & Sys. Eng.

Received on 2026-04-17 15:46:08