Standard way to supply hints to branches

Quirin Schroll qs.il.paperinik at gmail.com
Wed Sep 18 14:44:26 UTC 2024


On Friday, 13 September 2024 at 11:18:59 UTC, Zoadian wrote:
> On Friday, 13 September 2024 at 10:57:56 UTC, Quirin Schroll 
> wrote:
>> On Friday, 13 September 2024 at 10:26:48 UTC, Richard (Rikki) 
>> Andrew Cattermole wrote:
>> Let’s say you have a big switch in a hot loop. You profiled 
>> and now the data tells you how likely each branch was. What 
>> would you prefer? Reordering the branches by likelihood, 
>> leading to a diff that’s basically impossible to understand or 
>> even vet that it’s just a reordering, or the pure addition of 
>> likelihood annotations, for which in the diff it’s absolutely 
>> clear nothing else changes. And if there’s a fallthrough, you 
>> have to jump to the right case now.
>
> i'd prefer handing the compiler a profile log, and the compiler 
> just optimizing based on that file without the need to do any 
> annotations by hand.

Sure, that’s way easier for devs. You just can’t do that if you 
also want to distribute the code with the branch hints.


More information about the Digitalmars-d mailing list