The Performance Impact of C++'s `final` Keyword
91–100 of 385 posts
Re: The Performance Impact of C++'s `final` Keyword
#92Re: The Performance Impact of C++'s `final` Keyword
#93Re: The Performance Impact of C++'s `final` Keyword
#94Re: The Performance Impact of C++'s `final` Keyword
#95Re: The Performance Impact of C++'s `final` Keyword
#96Re: The Performance Impact of C++'s `final` Keyword
#97Re: The Performance Impact of C++'s `final` Keyword
#98Re: The Performance Impact of C++'s `final` Keyword
#99I profiled this project and there are abundant opportunities for devirtualization. The virtual interface `IHittable` is the hot one. However, the WITH_FINAL define is not sufficient, because the hot call is still virtual. At `hit_object |= _objects[node->object_index()]->hit` I am still seeing ` mov (%rdi),%rax; call *0x18(%rax)` so the application of final here was not sufficient to do the job. Whatever differences…
I haven't looked at the code, but if you have multiple leaves, even marking all of them as final won't help if the call is through a base class.
In cases where you have Dog and Goose that both derive from Animal and then you have std::vector, what is the compiler supposed to do?
Re: The Performance Impact of C++'s `final` Keyword
#100I don't do much C++, but I have definitely found that engineers will just assert that something is "faster" without any evidence to back that up. Quick example, I got in an argument with someone a few years ago that claimed in C# that a `switch` was better than an `if(x==1) elseif(x==2)...` because switch was "faster" and rejected my PR. I mentioned that that doesn't appear to be true, we went back and forth until I…
A significant part of it is that what engineers believe was effectively true at one time. They simply haven't revisited those beliefs or verified their relevance in a long time. It isn't a terrible heuristic for life in general to assume that what worked ten years ago will work today. The rate at which the equilibriums shift due to changes in hardware and software environments when designing for system performance is…
(the techniques that used to work were similar to earlier Java versions and overall very dynamic languages with some exceptions, the techniques that still work and now are required today are the same as in C++ or Rust)