A couple of trivial perf improvements:
-BMEMSET macro should cache the size of the memory block instead of reading each iteration -Avoid tesselating the backup copy of the mesh used to restore after an error (unless there is actually an error)
This commit is contained in:
@@ -109,10 +109,17 @@ BMEditMesh *BMEdit_Copy(BMEditMesh *tm)
|
||||
*tm2 = *tm;
|
||||
|
||||
tm2->derivedCage = tm2->derivedFinal = NULL;
|
||||
|
||||
tm2->looptris = NULL;
|
||||
|
||||
tm2->bm = BM_Copy_Mesh(tm->bm);
|
||||
BMEdit_RecalcTesselation(tm2);
|
||||
|
||||
/*The tesselation is NOT calculated on the copy here,
|
||||
because currently all the callers of this function use
|
||||
it to make a backup copy of the BMEditMesh to restore
|
||||
it in the case of errors in an operation. For perf
|
||||
reasons, in that case it makes more sense to do the
|
||||
tesselation only when/if that copy ends up getting
|
||||
used.*/
|
||||
tm2->looptris = NULL;
|
||||
|
||||
tm2->vert_index = NULL;
|
||||
tm2->edge_index = NULL;
|
||||
|
@@ -247,6 +247,6 @@ do { \
|
||||
# define BLI_assert(a) (void)0
|
||||
#endif
|
||||
|
||||
#define BMEMSET(mem, val, size) {unsigned int _i; char *_c = (char*) mem; for (_i=0; _i<size; _i++) *_c++ = val;}
|
||||
#define BMEMSET(mem, val, size) {unsigned int _i, _size = (size); char *_c = (char*) mem; for (_i=0; _i<_size; _i++) *_c++ = val;}
|
||||
|
||||
#endif // BLI_UTILDEFINES_H
|
||||
|
@@ -156,6 +156,7 @@ int EDBM_FinishOp(BMEditMesh *em, BMOperator *bmop, wmOperator *op, int report)
|
||||
|
||||
BMEdit_Free(em);
|
||||
*em = *emcopy;
|
||||
BMEdit_RecalcTesselation(em);
|
||||
|
||||
MEM_freeN(emcopy);
|
||||
em->emcopyusers = 0;
|
||||
|
Reference in New Issue
Block a user