8 ms·
So if you have a million vectors then you have wasted 8GB. It only makes sense if you have a few large vectors.
by poizan42 10y ago
So if you have a million vectors then you have wasted 8GB. It only makes sense if you have a few large vectors.
- viraptor 10y agoOr if you have fewer than millions. You jumped from millions to few large. That's not what applications usually need. And even within one application, you may want to mix the storage strategies between different objects.
- dunkelheit 10y agoFor a general-purpose container that is unacceptable. It must perform well from tiny to huge sizes. Also, syscalls in every constructor/destructor call? No thanks. What you describe might make sense for some special cases, but adopting it as a default strategy is a bad idea IMO. (Edit: re-read your other post in this thread and realized that you are not really advocating this. Well then my reply goes mostly to nkurz :)) > even within one application, you may want to mix the storage strategies between different objects. That's precisely what modern malloc implementations do.
- viraptor 10y ago> Also, syscalls in every constructor/destructor call? No thanks. You can batch up operations just like with normal list and malloc/free. Instead of 1 page, allocate some bigger size in one go.