Jump to content

  • Log In with Google      Sign In   
  • Create Account


How important are custom allocaters actually?


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
5 replies to this topic

#1 3DModelerMan   Members   -  Reputation: 814

Like
0Likes
Like

Posted 19 May 2013 - 09:14 AM

I have a custom allocation scheme in my engine because I want my game to run fast and efficiently on mobile phones and consoles like OUYA. I wrote a custom STL allocater and so far every library I use hooks into my allocation system. However there are some libraries that don't support hooking custom allocaters into that I would like to use. So my question is basically this: should I take the extra effort to make sure that STL integrates perfectly with my allocaters and use as few external libs that can't hook into them as possible? Or should custom allocaters just be used for the game engine itself?



Sponsor:

#2 markr   Crossbones+   -  Reputation: 1640

Like
1Likes
Like

Posted 19 May 2013 - 03:55 PM

I think you should ask yourself:

 

* Which game(s) have performance problems? On which devices?

* What do the profiling data tell you about the location of the problem(s)? Hopefully you can get a native profiler on all your target devices.

* What is the best way of fixing the specific problems?

 

If the answer to all of those points to a STL custom allocator being the BEST way of fixing the problem, then do it. Otherwise don't.



#3 Hodgman   Moderators   -  Reputation: 24033

Like
0Likes
Like

Posted 19 May 2013 - 08:01 PM

What does your custom one do differently from the default one?

#4 Krohm   Crossbones+   -  Reputation: 2748

Like
2Likes
Like

Posted 20 May 2013 - 01:12 AM

Some time ago I had a performance problem on my lowest-end supported devices (atom, FYI). I identified allocation as a problem. I rewrote the systems involved so I cut allocation count to 1/30.

I keep hearing about those custom allocators, but I wonder if all this people is really trying to minimize allocations in the first place, because this is what everyone should do first. Avoiding work. Not doing useless work faster.

Now, I'm not claiming people to be doing the wrong thing up start, it's just a question I have. Before trying to alloc faster, have you tried alloc'ing less frequently?

 

edit: typo.


Edited by Krohm, 20 May 2013 - 01:13 AM.


#5 3DModelerMan   Members   -  Reputation: 814

Like
0Likes
Like

Posted 20 May 2013 - 08:34 AM

That's a good point. Although my event system needs to make lots of allocations quickly. Maybe I could cut down on complexity if I just use custom allocation schemes in the areas I need them and not try to wrap everything in such a general purpose system.



#6 ApochPiQ   Moderators   -  Reputation: 12386

Like
2Likes
Like

Posted 20 May 2013 - 10:42 AM

The more allocation scenarios you use a custom allocator for, the closer it will degrade to general-purpose.

 

Profile first and foremost.

 

Allocate as little as possible.

 

For the remainder, decide on a specialized allocation strategy as much as possible. Does your event system really need a free-store style allocator, or can you get away with something like a stack allocator or a freelist/pool or some other mechanism?

 

Worst case, rearchitect your code to eliminate allocation overhead (while taking care not to introduce other forms of algorithmic overhead in the process).






Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS