From 660a6dc83a761c76b1b3a3c6d71c18800e0b47a3 Mon Sep 17 00:00:00 2001 From: Tavian Barnes Date: Sun, 29 Jun 2014 15:57:50 -0400 Subject: 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. --- libdimension/bvh.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'libdimension/bvh.c') 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; -- cgit v1.2.3