News for hackers. Stuff that matters.
Re:The cost of dynamic vs. static dispatch in C++ (2013) by MichaelGG on Saturday February 28, 2015 @05:59PM (#9125374)
Why shouldn't it be possible to inline virtual calls? The CLR folks were complaining about this, too. But it seems rather straightforward to figure out the actual implementation that's commonly called and inline it, perhaps with a guard for uncommon cases. And I wouldn't be surprised if many apps end up with only a single actual implementation, so the entire virtual overhead can just be dropped.
Re:The cost of dynamic vs. static dispatch in C++ (2013) by adrusi on Saturday February 28, 2015 @06:31PM (#9125451)
Because c++'s type system doesn't make it possible to determine the actual implementation in most cases. Concepts would allow rust-style monomorphization, but they aren't part if the standard yet.
Re:The cost of dynamic vs. static dispatch in C++ (2013) by kazinator on Saturday February 28, 2015 @08:30PM (#9125688)
None of this matters if you create the "flexible joints" in the right places, where you get the benefit of dispatch, without making hundreds of millions of calls per second to it.
Re:The cost of dynamic vs. static dispatch in C++ (2013) by coliveira on Saturday February 28, 2015 @06:26PM (#9125437)
The problem is that unlike the CLR, static compilers have no idea about the common case. This technique works only when you have some information about how the different code paths are being used.