4 ms·
In the general case you're right, in this case where the optimization is related to the usage of uninitialized memory I don't think that you're correct. Of cour
by renox 3y ago
In the general case you're right, in this case where the optimization is related to the usage of uninitialized memory I don't think that you're correct.
Of course this means that the programmer must 'think like an optimizer' and rewrite
is-member(i):
return sparse[i] < n && dense[sparse[i]] == i
as
uint sparse = sparse[i]
return sparse < n && dense[sparse] == i
otherwise the compiler would generate two load instead of 1.