diff options
author | Campbell Barton <ideasman42@gmail.com> | 2013-08-24 21:33:47 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2013-08-24 21:33:47 +0400 |
commit | 09a52f18b6d8bd77cbffd746f72e866e1740505f (patch) | |
tree | 525d2cd2121cd5e7112bcb26ffcca0445d979328 /source/blender/blenkernel/intern/pbvh.c | |
parent | 7bd422143e2ebab4f37fd8647206ec5d2235259e (diff) |
ghash: reserve size when its known or can be guessed close enough.
also avoid allocs per node in pbvh_bmesh_node_limit_ensure()
Diffstat (limited to 'source/blender/blenkernel/intern/pbvh.c')
-rw-r--r-- | source/blender/blenkernel/intern/pbvh.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/source/blender/blenkernel/intern/pbvh.c b/source/blender/blenkernel/intern/pbvh.c index 3907f4d8082..df227b6accb 100644 --- a/source/blender/blenkernel/intern/pbvh.c +++ b/source/blender/blenkernel/intern/pbvh.c @@ -277,11 +277,12 @@ static void build_mesh_leaf_node(PBVH *bvh, PBVHNode *node) GHash *map; int i, j, totface; - map = BLI_ghash_int_new("build_mesh_leaf_node gh"); - node->uniq_verts = node->face_verts = 0; totface = node->totprim; + /* reserve size is rough guess */ + map = BLI_ghash_int_new_ex("build_mesh_leaf_node gh", 2 * totface); + node->face_vert_indices = MEM_callocN(sizeof(int) * 4 * totface, "bvh node face vert indices"); |