RFC: Adding an alternative dispatch mechanism

bearophile bearophileHUGS at lycos.com
Fri Oct 1 15:49:06 PDT 2010


Austin Hastings:

> if each object stores 
> a vtable, then a class with a single int member pays a 32bit tax on 
> 32bits of storage, and I suppose 64bits of tax on 32bits of storage in 
> 64-bit land.

Beside the pointer to the virtual table, D objects have a 'monitor' (so the overhead is two CPU words), plus they may contain padding between the fields, plus for small memory blocks the allocator uses only power of two sizes, plus probably there is some GC overhead.

Regarding your idea I have found something related for C++:
http://www.boost.org/doc/libs/1_44_0/libs/flyweight/doc/index.html

Bye,
bearophile


More information about the Digitalmars-d mailing list