Time to move std.experimental.checkedint to std.checkedint ?

Max Haughton maxhaton at gmail.com
Wed Mar 31 14:36:57 UTC 2021


On Wednesday, 31 March 2021 at 12:36:42 UTC, Andrei Alexandrescu 
wrote:
> On 3/31/21 7:46 AM, Max Haughton wrote:
>> On Wednesday, 31 March 2021 at 09:47:46 UTC, Jacob Carlborg 
>> wrote:
>>> On Wednesday, 31 March 2021 at 04:49:52 UTC, Andrei 
>>> Alexandrescu wrote:
>>>
>>>> That makes their umbrella claim "Zig is faster than C" quite 
>>>> specious.
>>>
>>> The reason, or one of the reasons, why Zig is/can be faster 
>>> than C is that is uses different default optimization levels. 
>>> For example, Zig will by default target your native CPU 
>>> instead of some generic model. This allows to enable 
>>> vectorization, SSE/AVX and so on.
>>>
>>> --
>>> /Jacob Carlborg
>> 
>> Specific Example? GCC and LLVM are both almost rabid when you 
>> turn the vectorizer on
>
> Even if that's the case, "we choose to use by default different 
> flags that make the code more specialized and therefore faster 
> and less portable" can't be a serious basis of a language 
> performance claim.

Intel C++ can be a little naughty with the fast math options, 
last time I checked, for example - gotta get those SPEC numbers!

I wonder if there is a way to leverage D's type system (or even 
extend it to allow) to allow a library solution that can hold 
information which the optimizer can use to elide these checks in 
most cases. It's probably possible already by just passing some 
kind of abstract interpretation like data structure as a template 
parameter, but this is not very ergonomic.

Standardizing some kind of `assume` semantics strikes me as a 
good long term hedge for D, even if doing static analysis and 
formal verification of D code is an unenviable task.


More information about the Digitalmars-d mailing list