diff options
author | Campbell Barton <ideasman42@gmail.com> | 2015-04-11 16:36:37 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2015-04-11 16:36:37 +0300 |
commit | ccf44c400c896761c87836a06be24216c366c87b (patch) | |
tree | 5b6b677b19008c1eb2d89b6c172c33622a698c7c /source/blender/bmesh/intern/bmesh_log.c | |
parent | 7447a0173cc841a1e9bd3f655c3230382c1e7cb7 (diff) |
BMesh: simplify hashing for dyntopo
Was using pointer hashing when the keys are in fact uint's.
Since they're well distributed from the rangetree,
no need to do bit-shifting tricks. just use int as hash.
Gives ~8% speedup in own tests.
Diffstat (limited to 'source/blender/bmesh/intern/bmesh_log.c')
-rw-r--r-- | source/blender/bmesh/intern/bmesh_log.c | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/source/blender/bmesh/intern/bmesh_log.c b/source/blender/bmesh/intern/bmesh_log.c index c53b7f939c9..25ddb9ea79e 100644 --- a/source/blender/bmesh/intern/bmesh_log.c +++ b/source/blender/bmesh/intern/bmesh_log.c @@ -126,6 +126,10 @@ typedef struct { /************************* Get/set element IDs ************************/ +/* bypass actual hashing, the keys don't overlap */ +#define logkey_hash BLI_ghashutil_inthash_p_simple +#define logkey_cmp BLI_ghashutil_intcmp + /* Get the vertex's unique ID from the log */ static unsigned int bm_log_vert_id_get(BMLog *log, BMVert *v) { @@ -386,12 +390,12 @@ static BMLogEntry *bm_log_entry_create(void) { BMLogEntry *entry = MEM_callocN(sizeof(BMLogEntry), __func__); - entry->deleted_verts = BLI_ghash_ptr_new(__func__); - entry->deleted_faces = BLI_ghash_ptr_new(__func__); - entry->added_verts = BLI_ghash_ptr_new(__func__); - entry->added_faces = BLI_ghash_ptr_new(__func__); - entry->modified_verts = BLI_ghash_ptr_new(__func__); - entry->modified_faces = BLI_ghash_ptr_new(__func__); + entry->deleted_verts = BLI_ghash_new(logkey_hash, logkey_cmp, __func__); + entry->deleted_faces = BLI_ghash_new(logkey_hash, logkey_cmp, __func__); + entry->added_verts = BLI_ghash_new(logkey_hash, logkey_cmp, __func__); + entry->added_faces = BLI_ghash_new(logkey_hash, logkey_cmp, __func__); + entry->modified_verts = BLI_ghash_new(logkey_hash, logkey_cmp, __func__); + entry->modified_faces = BLI_ghash_new(logkey_hash, logkey_cmp, __func__); entry->pool_verts = BLI_mempool_create(sizeof(BMLogVert), 0, 64, BLI_MEMPOOL_NOP); entry->pool_faces = BLI_mempool_create(sizeof(BMLogFace), 0, 64, BLI_MEMPOOL_NOP); |