3 ms·
@verdagon Can you please explain https://verdagon.dev/blog/generational-references https://verdagon.dev/blog/generational-references comment that: "programs der
by ashish_negi_ 4y ago
@verdagon Can you please explain https://verdagon.dev/blog/generational-references https://verdagon.dev/blog/generational-references comment that: "programs dereference less than they alias and dealias" ?
Does deference means accessing a field of object ?
Does alias/dealias mean creating/destroying another variable reference ?
If answer of above is true, isn't programs deference more than alias/dealias ?
i mean, in:
var alias = shared_ptr_of_some_object;
for (int i = 0; i < 1000; ++i) {
alias.foo += bar_fn(alias.baz)
}
is just creating 1 alias but defrences 1k times and above looks like very typical code.
- verdagon 4y agoYep, thats what we mean with dereferencing, aliasing, and dealiasing. That statement is referring to our sample program, a roguelike game that we use for benchmarking. As for why this is the case, I'm not sure! I suspect its because a lot of classes will alias/dealias objects without ever dereferencing them, such as List<T>, HashMap<T>, etc.