Original Post
Hello. What can I do to make my scenegraph as fast as possible, I know that it veries how it looks. But tell me some potential bottlenecks and what kind of methods that makes it faster. / Christoffer
Hello. What can I do to make my scenegraph as fast as possible, I know that it veries how it looks. But tell me some potential bottlenecks and what kind of methods that makes it faster. / Christoffer
Quote:
Original post by hplus0603
In general: Profile it, and make it faster where the profile tells you it's slow.
Call it less often.
Avoid cache fetches -- use arrays instead of lists where possible.
Use custom block allocators for nodes, instead of new/delete.
Accelerate the queries you make frequently by building appropriate indices (i e, loose octree for frustum/sphere queries; list of specific node types for node type queries ("all light") etc).
When updating nodes in an octree, don't remove and re-insert, but first check whether the node can stay put in the same octree cell.
Make data structures as small as possible, so you get less cache thrashing.
Use lazy evaluation to avoid unnecessary computation. That also means: don't ask for data unless you absoultely need it.
Quote:
Original post by dbzprogrammer
Use custom block allocators? What do you mean by that?
Quote:
Original post by Konfusius Quote:
Original post by dbzprogrammer
Use custom block allocators? What do you mean by that?
A block allocator is different from a "standard", general variable-size allocator (like malloc()/new), which is costly in terms of CPU because it has to preserve locality and fight memory fragmentation and whatnot, in that it gives you only blocks of a certain granularity (like, for example, the size of one scene node).
This allocator design is also called "Simple Segregated Storage", for obvious reasons.
You can read a lot on memory managment in the great text "An Operating Systems Vade Mecum" by Raphael A. Finkel.
Quote:
Original post by dbzprogrammer
So, you mean that you create a more defined type of memory allocator? (Overloading "new" I presume.) But how do you tell it to not to be so general?
This topic has been locked by a moderator. New replies are not allowed.
With your permission, GameDev.net uses analytics cookies to understand how people use the platform. You can accept analytics or continue with necessary cookies only. Learn more