4 ms·
> did every function call go through a indirection Yes.
by kayamon 10y ago
> did every function call go through a indirection
Yes.
- Arelius 10y agoI wonder if that would still be an acceptable trade-off with high-performance games on modern memory architectures.
- kayamon 10y agoMy suspicion is "yes" -- the PS2 wasn't great at memory access, and modern CPU tend to have better caching/branch prediction anyway.
- sedachv 10y agoNo need to wonder. That is exactly how C++ vtables work.
- fla 10y agoFor virtual functions. Not all calls get an indirection. At least with any respectable compiler..
- sedachv 10y agoRight, and how many game developers are recommending to "never use virtual functions because they are slow" in 2017? I remember seeing statements like that in Usenet posts and articles from the 1990s.
- anewhnaccount 10y agohttps://shaneenishry.com/blog/2014/12/27/misconceptions-of-component-based-entity-systems/ https://shaneenishry.com/blog/2014/12/27/misconceptions-of-c... is from 2014. I tend to think it might actually make a difference in this case given it's a vtable indirection for every entity every frame (or for every subsystem * every subsystem tick).
- Arelius 10y agoAlso, "never use virtual functions" is very different than "don't use virtual functions everywhere" Common wisdom is that virtual function usage in hot loops can become problematic.
- Arelius 10y agoAlso, "never use virtual functions" is very different than "don't use virtual functions everywhere" Common wisdom is that virtual function usage in hot loops can become problematic.
- Arelius 10y agoYeah, and in C++ one also avoids vtables when possible.