Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon.

Pages: 1-

std::map performance

Name: Anonymous 2007-01-19 3:58

Hi /prog/,

I have a routine where I'm using a std::map from a pair of ints to double
for caching evaluation results.
The cache depth could be upto say 1000 in depth.
However, my application needs to clear and replenish the cache repeatedly
and profiling seems to suggests
the performance is handicated by repeated calls to new.
Can anybody advice me on how to improve the performance or suggests
alternatives please.

Thanks in advance.

Name: Anonymous 2007-01-19 4:34

Make a pool of virtual address space of about 256 megs. Then overload the new operator and allocate and de-allocate memory via that memory pool.

You will want to actualy have two link lists. One that is the free memory and another that is the used memory. From the free list you simply return the first one that is less or equal the size. If their isnt any, check to see that you can merge two together that are adjacent in the memory address. What you will find is that, typical algorthems will frequencly delete and re-use the same amount of memory.

Name: Anonymous 2007-01-19 4:56

>>1
>>2

Same person

Name: Anonymous 2007-01-19 14:13

>>1
First solution: keep the object, don't delete it, clear() it instead
Second solution: http://www.boost.org/libs/pool/doc/index.html
Third solution: IHBT.

Name: Anonymous 2009-01-14 14:41

Troll detected.

Name: Anonymous 2011-02-03 5:49

Name: Anonymous 2012-03-23 23:34

All work and no play makes Jack a dull boy

All work and no play makes Jack a dull boyAll work and no play makes Jack a dull boy

All work and no play makes Jack a dull boy

All work and no play makes Jack a dull boy

All work and no play makes Jack a dull boy

All work and no play makes Jack a dull boy

All work and no play makes Jack a dull boy

All work and no play makes Jack a dull boy

All work and no play makes Jack a dull boy

All work and no play makes Jack a dull boy

All work and no play makes Jack a dull boyAll work and no play makes Jack a dull boy

All work and no play makes Jack a dull boy

All work and no play makes Jack a dull boy

All work and no play makes Jack a dull boy

All work and no play makes Jack a dull boy

All work and no play makes Jack a dull boy

All work and no play makes Jack a dull boy

All work and no play makes Jack a dull boy

All work and no play makes Jack a dull boy

All work and no play makes Jack a dull boyAll work and no play makes Jack a dull boy

All work and no play makes Jack a dull boy

All work and no play makes Jack a dull boy

All work and no play makes Jack a dull boy

All work and no play makes Jack a dull boy

All work and no play makes Jack a dull boy

All work and no play makes Jack a dull boy

All work and no play makes Jack a dull boy

All work and no play makes Jack a dull boy

All work and no play makes Jack a dull boyAll work and no play makes Jack a dull boy

All work and no play makes Jack a dull boy

All work and no play makes Jack a dull boy

All work and no play makes Jack a dull boy

All work and no play makes Jack a dull boy

All work and no play makes Jack a dull boy

All work and no play makes Jack a dull boy

All work and no play makes Jack a dull boy

All work and no play makes Jack a dull boy

All work and no play makes Jack a dull boyAll work and no play makes Jack a dull boy

All work and no play makes Jack a dull boy

All work and no play makes Jack a dull boy

All work and no play makes Jack a dull boy

All work and no play makes Jack a dull boy

All work and no play makes Jack a dull boy

All work and no play makes Jack a dull boy

All work and no play makes Jack a dull boy

All work and no play makes Jack a dull boy

All work and no play makes Jack a dull boyAll work and no play makes Jack a dull boy

All work and no play makes Jack a dull boy

All work and no play makes Jack a dull boy

All work and no play makes Jack a dull boy

All work and no play makes Jack a dull boy

All work and no play makes Jack a dull boy

All work and no play makes Jack a dull boy

All work and no play makes Jack a dull boy

Name: Sgt.Kabu弙䘥kiman끥戉 2012-05-28 21:54

Bringing /prog/ back to its people
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy

Don't change these.
Name: Email:
Entire Thread Thread List