Sign in to follow this  
Florian Millet

Memory Pool Benchmark

Recommended Posts

Hi all, I'd like to know if someone could post a _good_ way to benchmark (code or otherwise) a memory pool system, i've written my own but i have no solid proof whereas it is faster than the traditionnal new/delete system (i hope so!!). Also, what kind of time decrease am i looking for (to be a good memory pool system) ? thank you. --- Millet Florian

Share this post


Link to post
Share on other sites
for n iterations
mark time
allocate m objects
mark time
delete m objects
mark time

m <= max pool elements
just sum time deltas and make an averege over n iterations.

imho :)

[edit]
well, u could also add third time delta, ie: an operation over that object/piece of mem.

Share this post


Link to post
Share on other sites
Actually, that's a horrible bench mark.

1) No fragmentation testing at all.
2) Allocations are rarely contiguous like that, same for deallocations
3) You're not actually using the memory at all. You must access the memory, otherwise it will end up being optimized out. (any decent compiler will eliminate such a NOP)

Share this post


Link to post
Share on other sites
Quote:
Original post by vesoljc
Quote:
Original post by Washu
2) Allocations are rarely contiguous like that, same for deallocations


heh, bad design

Not really, it's called real world. Things don't always happen in a nice linear order like that. Especially as applications become larger and larger.

Share this post


Link to post
Share on other sites
@washu
;)

@florian
time decrease should be visible while allocating objects. as for how much, i'd say that size does matter.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this