Potential optimisation - fix a memory hole #1583
AnyOldName3
started this conversation in
Ideas
Replies: 2 comments
|
Definitely worth trying swapping the order. The internal nodes of the scene graph will be the most sensitive to optimization. Another approach might be to play tricks with the auxiliary pointer so it's only 32bit, but this would add some extra work when de-referencing the auxiliary pointer, how the auxiliary objects tend to be rarely used and accessed. However, cutting the vsg::Object size from 24 to 16 bytes would benefit all nodes in the scene graph, including those internal scene graph nodes that get hammered most during traversal. |
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment

Uh oh!
There was an error while loading. Please reload this page.
I just took a look at the memory layout for
vsg::VertexDrawbecause of something I was doing in a subclass, and realised thatvsg::Objectand every class that derives from it has a four-byte memory hole. In the case ofvsg::VertexDrawin particular, it's got two of them as it's got fiveuint32_tfields followed by fields with eight-byte alignment. If the reference count and auxiliary pointer invsg::Objectwere swapped, then the firstuint32_tcould slot in after the reference count and the class would be eight bytes smaller. Obviously, that'd be an improvement for cache hit rates, and it seems like a fairly low-risk change considering how manyvsg::Objectsubclasses it's likely to compact.All reactions