6 ms·
On the other hand, if the compiler can prove at compile-time what type the object must have at run-time, it can eliminate the dynamic dispatch and effectively r
by branko_d 8mo ago
On the other hand, if the compiler can prove at compile-time what type the object must have at run-time, it can eliminate the dynamic dispatch and effectively re-enable inlining.
- MarsIronPI 8mo agoWhich is why runtime polymorphism in Rust is very hard to do. The its focus on zero-cost abstractions means that the natural way to write polymorphic code is compiled (and must be compiled) to static dispatch.
- khuey 8mo agoCompilers will also speculatively devirtualize under some circumstances. https://hubicka.blogspot.com/2014/02/devirtualization-in-c-part-4-analyzing.html https://hubicka.blogspot.com/2014/02/devirtualization-in-c-p...