Originally posted by: wayside
This is a very nice intro on allocators, thanks a lot!
Some questions, though:
1) I don't understand why the memory allocation scheme would affect sorting times. Aren't the sort algorithms just shuffling pointers around? Can you explain this?
2) Your benchmarks are interesting, however: a) printing out times to the hundred-billionth of a second is meaningless, no timer can resolve to that level; b) it's not clear what you are measuring, whether it's cpu time or elasped time - if elapsed time, these numbers seem far too small to be meaningful, it takes very little to introduce a random extra millisecond or two into a process (printing out text in a window, for example). Can you run these again using, say 1,000,000 or 10,000,000 as the size?
3) Is sorting a reasonable test of the performance of the allocator? It seems to me that it is not, because you are not deleting and inserting items in the memory pool. You are not really exercising the allocator by just allocating a big chunk all at once and then deleting the whole thing at once.
Thanks again for a terrific article.
Reply
Originally posted by: Steven Don
I've been wondering about custom allocators. Haven't read the complete article yet, but so far it seems like an excellent, thorough, source of information for this.
ReplyOriginally posted by: Yves
Nice work, Gabriel and Andreas,
Having gone through trying to implement custom allocators under VC6 / STLPort, I know how difficult it is to actually find out what you need to implement to make the rebind functionality even compile. Plus, the discussion about your allocator is also interesting.
A couple of links which may be of interest:
A discussion about allocators and performance:
http://www.cs.umass.edu/~emery/
An example by Jossutis of a custom allocator (requires VC7 or GCC 3.X)
http://www.josuttis.com/libbook/examples.html
Yves
Reply