Jump to content
  • Advertisement
Sign in to follow this  
Ranger_One

Memory Allocation Optimization

This topic is 5389 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Well, after scouring the net looking for good examples: comparing the performance of dynamic memory allocation versus. 'quasi' pre-allocation schemes, I came back empty handed. Spending a couple hours I wrote up two classes: AllocTable AllocPaged These allocate fixed size AllocdThing class objects using simple New() and Delete() function calls. Then I benched them using this method: Built a random sequence of 65k unsigned short ints. Looped through them 500,000 times to get the current operation. 50% of the operations modified random allocated objects. 25% of the operations allocated new objects. 25% of the operations de-allocated random objects. The test was looped 10 times (since I use the time.h clock() funcs and need to strip out inaccuracy) and the median taken. End result: Averaged ratio: Paged is 1.7 times faster than Tabled. So, using something the tries to replicate actual object use, it *looks like* pre-allocated pages of objects are roughly 70% faster than dynamically allocated ones. The source can be found here: (main.cpp, alloc.h, alloc.cpp) AllocTest.rar

Share this post


Link to post
Share on other sites
Advertisement
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!