Time to move std.experimental.checkedint to std.checkedint ?
tsbockman
thomas.bockman at gmail.com
Mon Mar 29 19:25:50 UTC 2021
On Monday, 29 March 2021 at 16:41:12 UTC, Andrei Alexandrescu
wrote:
> Checked code is larger, meaning more pressure on the scarce
> I-cache in large programs - and that's not going to be visible
> in microbenchmarks.
This is true. But, at the moment I don't have an easy way to
quantify the size of that effect.
> And "I/O is slow anyway" is exactly what drove the development
> of C++ catastrophically slow iostreams.
That's really not what I said, though. What I actually said is:
0) The performance of hot code is usually limited by something
other than semantically non-wrapping integer arithmetic.
1) When non-wrapping integer arithmetic is the bottleneck, the
compiler should usually be able to optimize away most of the cost
of checking for overflow.
2) When the compiler cannot optimize away most of the cost,
programmers can usually do so manually.
3) Programmers could still disable the checks entirely wherever
they consider the performance gain worth the damage done to
correctness/reliability.
4) Outside of hot code, the cost isn't significant.
You're picking on (0), but the validity of my claim that checked
arithmetic by default wouldn't negatively impact performance much
mainly depends upon the truth of (4) plus either the truth of
(1), or the willingness and ability of programmers to take
advantage of (2) and (3).
More information about the Digitalmars-d
mailing list