Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSv. Lockal <lockalsash@gmail.com>2013-08-03 15:35:09 +0400
committerSv. Lockal <lockalsash@gmail.com>2013-08-03 15:35:09 +0400
commit66a40779271b55498216cc14b4df3ca8d575137c (patch)
treefdd0ed4df73ca2ecb9f3c58813e8338c53eedadb /source/blender/blenlib/intern/BLI_mempool.c
parent91d148b8914bb198a78c3789fa39c2850d37d219 (diff)
fix for [#36260] 2,300 Objects Makes Blender Unresponsive
- performance of outliner was low because of unoptimal data structures. - now it uses BLI_mempool instead of custom mempool and GHash to make searches for duplicates faster. - also fix undesired behaviour of BLI_mempool_as_arrayN thanks to Campbell Barton and Lukas Tönne for helping me get a better fix put together.
Diffstat (limited to 'source/blender/blenlib/intern/BLI_mempool.c')
-rw-r--r--source/blender/blenlib/intern/BLI_mempool.c14
1 files changed, 12 insertions, 2 deletions
diff --git a/source/blender/blenlib/intern/BLI_mempool.c b/source/blender/blenlib/intern/BLI_mempool.c
index 217a4b9d266..f370f32c31d 100644
--- a/source/blender/blenlib/intern/BLI_mempool.c
+++ b/source/blender/blenlib/intern/BLI_mempool.c
@@ -354,8 +354,18 @@ void BLI_mempool_as_array(BLI_mempool *pool, void **data)
*/
void *BLI_mempool_as_arrayN(BLI_mempool *pool, const char *allocstr)
{
- void *data = MEM_mallocN((size_t)(BLI_mempool_count(pool) * pool->esize), allocstr);
- BLI_mempool_as_array(pool, data);
+ char *data = MEM_mallocN((size_t)(pool->totused * pool->esize), allocstr);
+ BLI_assert(pool->flag & BLI_MEMPOOL_ALLOW_ITER);
+ if (data) {
+ BLI_mempool_iter iter;
+ char *elem, *p = data;
+ BLI_mempool_iternew(pool, &iter);
+ for (elem = BLI_mempool_iterstep(&iter); elem; elem = BLI_mempool_iterstep(&iter)) {
+ memcpy(p, elem, (size_t)pool->esize);
+ p += pool->esize;
+ }
+ BLI_assert((p - data) == pool->totused * pool->esize);
+ }
return data;
}