Hi,
On 2024-03-04 08:47:11 -0300, Ranier Vilela wrote:
> Does filling a memory area, one by one, with branches, need strong evidence
> to prove that it is better than filling a memory area, all at once, without
> branches?
That's a bogus comparison:
a) the memset version modifies the whole array, rather than just elements that
correspond to an item - often there will be far fewer items than the
maximally possible number
b) the memset version initializes array elements that will be set to an actual
value
c) switching to memset does not elide any branches, as the branch is still
needed
And even without those, it'd still not be obviously better to use an
ahead-of-time memset(), as storing lots of values at once is more likely to be
bound by memory bandwidth than interleaving different work.
Andres