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/bmesh/intern/bmesh_log.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/bmesh/intern/bmesh_log.c')
-rw-r--r-- | source/blender/bmesh/intern/bmesh_log.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/source/blender/bmesh/intern/bmesh_log.c b/source/blender/bmesh/intern/bmesh_log.c index 09fdb0c73f6..30728636a58 100644 --- a/source/blender/bmesh/intern/bmesh_log.c +++ b/source/blender/bmesh/intern/bmesh_log.c @@ -407,7 +407,7 @@ static int uint_compare(const void *a_v, const void *b_v) */ static GHash *bm_log_compress_ids_to_indices(unsigned int *ids, int totid) { - GHash *map = BLI_ghash_int_new(AT); + GHash *map = BLI_ghash_int_new_ex(AT, totid); int i; qsort(ids, totid, sizeof(*ids), uint_compare); @@ -441,8 +441,8 @@ BMLog *BM_log_create(BMesh *bm) BMLog *log = MEM_callocN(sizeof(*log), AT); log->unused_ids = range_tree_uint_alloc(0, (unsigned)-1); - log->id_to_elem = BLI_ghash_ptr_new(AT); - log->elem_to_id = BLI_ghash_ptr_new(AT); + log->id_to_elem = BLI_ghash_ptr_new_ex(AT, bm->totvert + bm->totface); + log->elem_to_id = BLI_ghash_ptr_new_ex(AT, bm->totvert + bm->totface); /* Assign IDs to all existing vertices and faces */ bm_log_assign_ids(bm, log); |