summaryrefslogtreecommitdiffstats
path: root/libdimension/bvh.c
diff options
context:
space:
mode:
authorTavian Barnes <tavianator@tavianator.com>2014-06-29 15:57:50 -0400
committerTavian Barnes <tavianator@tavianator.com>2014-06-29 16:00:25 -0400
commit660a6dc83a761c76b1b3a3c6d71c18800e0b47a3 (patch)
tree1b0d412200f4bd34e92ff5da048be86a00dee569 /libdimension/bvh.c
parent87e95a688130cd4059a5e3edd8885441a16eeaf6 (diff)
downloaddimension-660a6dc83a761c76b1b3a3c6d71c18800e0b47a3.tar.xz
prtree: Improve cache locality during tree building.
This gives about a 25% speedup by storing the node color in a smaller wrapper struct instead of inside the node itself.
Diffstat (limited to 'libdimension/bvh.c')
-rw-r--r--libdimension/bvh.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/libdimension/bvh.c b/libdimension/bvh.c
index 462cbee..d1bd0fc 100644
--- a/libdimension/bvh.c
+++ b/libdimension/bvh.c
@@ -358,10 +358,9 @@ dmnsn_bvh_bounding_box(const dmnsn_bvh *bvh)
}
dmnsn_bvh_node *
-dmnsn_new_bvh_node(size_t max_children)
+dmnsn_new_bvh_node(unsigned int max_children)
{
- dmnsn_bvh_node *node = dmnsn_malloc(sizeof(dmnsn_bvh_node)
- + max_children*sizeof(dmnsn_bvh_node *));
+ dmnsn_bvh_node *node = dmnsn_malloc(sizeof(dmnsn_bvh_node) + max_children*sizeof(dmnsn_bvh_node *));
node->bounding_box = dmnsn_zero_bounding_box();
node->object = NULL;
node->nchildren = 0;