It is an interesting thought to call memory potential referanced a large number of times cache pollution. What exactly is in the cache that isn''t pollution? You really only have two alternatives which is putting the vtable in the instance which would be real cache pollution as you replicate copies of the vtable everywhere or conditionals to determine which function you should call. Certainly the fastest thing you can do is nothing since it takes no time, but it isn''t real useful I''m all for optimization, but doing it to the point that you have no program is a bit excessive.
Sorry, just couldn''t resist giving you a hard time
Vtable overhead!
Much in the same way that I didn''t mean to imply that a cache miss will occur on every virtual function call, I don''t mean to imply that loading the vtable on every virtual function call is cache pollution. However, I can qualify times when it should be considered cache pollution. In terms of DFA, a call to a virtual function can be bound at compile time, link time or runtime. That is to say that the actual address of the called function can be determined in any of those three times. If the vtable is loaded on an instance when the address of the function being called can be determined at run time or link time than that would be considered cache pollution (as well as spurious indirection). Fortunately the vast majority of compile time bindings are optimized out. The same can''t be said of the link time bindings. Now if you work with frameworks frequently, you''ll find a lot of these link time binding problems, which are the primary source of what I consider cache pollution from vtable loading.
I was just giving you a hard time, but that was a very good reply. I assume you meant compile time rather than run time on the spurious indirection part. That does an excellant job of precisely qualifying the statement. My comments were in jest, but often those precise qualifications help people understand the point better. I got in a habit of doing that dealing with what I would call subject matter experts such as yourself just to be sure I understand their point rather than assuming I do.
Keys to success: Ability, ambition and opportunity.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement
Recommended Tutorials
Advertisement