3 ms·
The ultra short version of what he is saying is that generics allow you to provide information to the compiler that enables inlining. So instead of doing someth
by mcluck 4y ago
The ultra short version of what he is saying is that generics allow you to provide information to the compiler that enables inlining. So instead of doing something like this (pseudo assembly)
PUSH x
PUSH y
CALL compare
CMP x y
POP
You end up with
CMP x y
Of course this will vary based on the type that you're optimizing for but in all cases you're removing the need to push and pop the stack for every comparison. I'm not smart enough to talk about other optimizations enabled by generics though.