dmd foreach loops throw exceptions on invalid UTF sequences, use replacementDchar instead

Andrei Alexandrescu SeeWebsiteForEmail at erdani.com
Sat Nov 6 00:40:41 UTC 2021


On 2021-11-05 20:03, Walter Bright wrote:
> On 11/5/2021 2:43 PM, deadalnix wrote:
>> I have not checked for GCC, but modern version of LLVM are pretty good 
>> at optimizing in the presence of landing pads.
> 
> I saw a presentation by Chandler Carruth at CPPCON 3 years back or so 
> where he said that LLVM abandoned much of the optimizations in the 
> presence of rewind blocks.

Three years is a long time in this industry.

> Optimizations will do better, of course, if your tight loops don't call 
> functions that might throw.
> 
> You'll also lose simply because the extra bulk of the EH code will push 
> more of your hot code out of the cache.

Turns out the EH code is very well separated. Gcc goes so far as to 
generate two separate functions, one for hot and one for cold. Clang 
also does a good job separating the paths.

It happens in our metier that good judgment becomes prejudice. It seems 
that's what happening with "exceptions are expensive" right now.


More information about the Digitalmars-d mailing list