There are a lot of popular talks this year on C++ cache utilization optimizations (alike this). From that videos it seems like having god objects (pseudocode):
class apples {
vector<int> property_1_Values;
vector<float> property_2_Values;
};
instead of
class apple {
int property_1;
float property_2;
};
so that iterationg from N'th element to M'th would be cache optimal (*they also say tht cpu can predict not only ++
/--
but also +-const
sequences).
Well I can see the point, also I can see how to reimplement my programs logic to fit into such model... yet it feels like a really architecturaly bad idea - create god objects, reinvent inheritance... So it seams for me that this is should be a compiler optimization not programmers headake.
So I wonder what OO language VM/compiler has already implemented such objects restructuring at programm compile/evecution time? (so that OO programmer would not have to make such handmade optimizations)? .NET, JVM, Clang, anyone?
Update:
Profile as a guidence for implementation of such thing is a really sad and bad answer - to implement such god object optimally one would require tons of profiling, debugging etc (such god object is in a sence a micro GC becuse reduce vector size on each object addition or removal would be painfull...) this is why I've hoped existing VMs already heve done that. I heve not sceen code generators/template classes that would provide a factory with resonable interface in C+... so idea of such thing seems to be scary when you have 100+k lines of code and a new not well tested god object...