Revision: 23099 http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=23099 Author: joeedh Date: 2009-09-10 03:46:52 +0200 (Thu, 10 Sep 2009)
Log Message: ----------- another optimization pass. biggest change is MDeformGroup->dw is now allocated via a somewhat simplistic, if effective allocator. This needs a little bit more work; I'd really prefer building this into guardedalloc, but the method requires mempools, which currently live in blenlib. and I'm not sure if we can have guardedalloc linking with blenlib? anyway, current allocator code is more of a temporary fix until I figure that out. Modified Paths: -------------- branches/bmesh/blender/source/blender/blenkernel/intern/BME_tools.c branches/bmesh/blender/source/blender/blenkernel/intern/armature.c branches/bmesh/blender/source/blender/blenkernel/intern/cloth.c branches/bmesh/blender/source/blender/blenkernel/intern/constraint.c branches/bmesh/blender/source/blender/blenkernel/intern/customdata.c branches/bmesh/blender/source/blender/blenkernel/intern/deform.c branches/bmesh/blender/source/blender/blenkernel/intern/editderivedbmesh.c branches/bmesh/blender/source/blender/blenkernel/intern/key.c branches/bmesh/blender/source/blender/blenkernel/intern/lattice.c branches/bmesh/blender/source/blender/blenkernel/intern/mesh.c branches/bmesh/blender/source/blender/blenkernel/intern/modifier.c branches/bmesh/blender/source/blender/blenkernel/intern/modifiers_bmesh.c branches/bmesh/blender/source/blender/blenkernel/intern/particle.c branches/bmesh/blender/source/blender/blenkernel/intern/softbody.c branches/bmesh/blender/source/blender/blenlib/intern/BLI_mempool.c branches/bmesh/blender/source/blender/blenloader/intern/readfile.c branches/bmesh/blender/source/blender/bmesh/intern/bmesh_mesh.c branches/bmesh/blender/source/blender/editors/mesh/bmesh_tools.c branches/bmesh/blender/source/blender/editors/object/object_vgroup.c branches/bmesh/blender/source/blender/editors/sculpt_paint/paint_vertex.c branches/bmesh/blender/source/blender/windowmanager/intern/wm_init_exit.c Added Paths: ----------- branches/bmesh/blender/source/blender/blenlib/BLI_cellalloc.h branches/bmesh/blender/source/blender/blenlib/intern/BLI_cellalloc.c Modified: branches/bmesh/blender/source/blender/blenkernel/intern/BME_tools.c =================================================================== --- branches/bmesh/blender/source/blender/blenkernel/intern/BME_tools.c 2009-09-10 01:14:21 UTC (rev 23098) +++ branches/bmesh/blender/source/blender/blenkernel/intern/BME_tools.c 2009-09-10 01:46:52 UTC (rev 23099) @@ -44,6 +44,7 @@ #include "BKE_bmesh.h" #include "BLI_arithb.h" #include "BLI_blenlib.h" +#include "BLI_cellalloc.h" /*split this all into a seperate bevel.c file in src*/ Modified: branches/bmesh/blender/source/blender/blenkernel/intern/armature.c =================================================================== --- branches/bmesh/blender/source/blender/blenkernel/intern/armature.c 2009-09-10 01:14:21 UTC (rev 23098) +++ branches/bmesh/blender/source/blender/blenkernel/intern/armature.c 2009-09-10 01:46:52 UTC (rev 23099) @@ -38,6 +38,7 @@ #include "BLI_arithb.h" #include "BLI_blenlib.h" +#include "BLI_cellalloc.h" #include "DNA_armature_types.h" #include "DNA_action_types.h" Modified: branches/bmesh/blender/source/blender/blenkernel/intern/cloth.c =================================================================== --- branches/bmesh/blender/source/blender/blenkernel/intern/cloth.c 2009-09-10 01:14:21 UTC (rev 23098) +++ branches/bmesh/blender/source/blender/blenkernel/intern/cloth.c 2009-09-10 01:46:52 UTC (rev 23099) @@ -48,6 +48,7 @@ #include "BKE_pointcache.h" #include "BLI_kdopbvh.h" +#include "BLI_cellalloc.h" #ifdef _WIN32 void tstart ( void ) Modified: branches/bmesh/blender/source/blender/blenkernel/intern/constraint.c =================================================================== --- branches/bmesh/blender/source/blender/blenkernel/intern/constraint.c 2009-09-10 01:14:21 UTC (rev 23098) +++ branches/bmesh/blender/source/blender/blenkernel/intern/constraint.c 2009-09-10 01:46:52 UTC (rev 23099) @@ -38,6 +38,7 @@ #include "BLI_blenlib.h" #include "BLI_arithb.h" #include "BLI_editVert.h" +#include "BLI_cellalloc.h" #include "DNA_armature_types.h" #include "DNA_constraint_types.h" Modified: branches/bmesh/blender/source/blender/blenkernel/intern/customdata.c =================================================================== --- branches/bmesh/blender/source/blender/blenkernel/intern/customdata.c 2009-09-10 01:14:21 UTC (rev 23098) +++ branches/bmesh/blender/source/blender/blenkernel/intern/customdata.c 2009-09-10 01:46:52 UTC (rev 23099) @@ -38,6 +38,7 @@ #include "BLI_blenlib.h" #include "BLI_linklist.h" #include "BLI_mempool.h" +#include "BLI_cellalloc.h" #include "DNA_customdata_types.h" #include "DNA_listBase.h" @@ -112,7 +113,7 @@ MDeformVert *dvert = (MDeformVert *)((char *)dest + i * size); if(dvert->totweight) { - MDeformWeight *dw = MEM_callocN(dvert->totweight * sizeof(*dw), + MDeformWeight *dw = BLI_cellalloc_calloc(dvert->totweight * sizeof(*dw), "layerCopy_mdeformvert dw"); memcpy(dw, dvert->dw, dvert->totweight * sizeof(*dw)); @@ -131,7 +132,7 @@ MDeformVert *dvert = (MDeformVert *)((char *)data + i * size); if(dvert->dw) { - MEM_freeN(dvert->dw); + BLI_cellalloc_free(dvert->dw); dvert->dw = NULL; dvert->totweight = 0; } @@ -173,7 +174,7 @@ /* if this def_nr is not in the list, add it */ if(!node) { - MDeformWeight *tmp_dw = MEM_callocN(sizeof(*tmp_dw), + MDeformWeight *tmp_dw = BLI_cellalloc_calloc(sizeof(*tmp_dw), "layerInterp_mdeformvert tmp_dw"); tmp_dw->def_nr = dw->def_nr; tmp_dw->weight = dw->weight * interp_weight; @@ -184,10 +185,10 @@ } /* now we know how many unique deform weights there are, so realloc */ - if(dvert->dw) MEM_freeN(dvert->dw); + if(dvert->dw) BLI_cellalloc_free(dvert->dw); if(totweight) { - dvert->dw = MEM_callocN(sizeof(*dvert->dw) * totweight, + dvert->dw = BLI_cellalloc_calloc(sizeof(*dvert->dw) * totweight, "layerInterp_mdeformvert dvert->dw"); dvert->totweight = totweight; Modified: branches/bmesh/blender/source/blender/blenkernel/intern/deform.c =================================================================== --- branches/bmesh/blender/source/blender/blenkernel/intern/deform.c 2009-09-10 01:14:21 UTC (rev 23098) +++ branches/bmesh/blender/source/blender/blenkernel/intern/deform.c 2009-09-10 01:46:52 UTC (rev 23099) @@ -60,6 +60,7 @@ #include "BLI_blenlib.h" #include "BLI_arithb.h" +#include "BLI_cellalloc.h" #ifdef HAVE_CONFIG_H #include <config.h> Modified: branches/bmesh/blender/source/blender/blenkernel/intern/editderivedbmesh.c =================================================================== --- branches/bmesh/blender/source/blender/blenkernel/intern/editderivedbmesh.c 2009-09-10 01:14:21 UTC (rev 23098) +++ branches/bmesh/blender/source/blender/blenkernel/intern/editderivedbmesh.c 2009-09-10 01:46:52 UTC (rev 23099) @@ -132,6 +132,9 @@ if (tm->looptris) MEM_freeN(tm->looptris); +#if 0 //simple quad/triangle code for performance testing purposes + looptris = MEM_callocN(sizeof(void*)*bm->totface*8, "looptris"); + f = BMIter_New(&iter, bm, BM_FACES_OF_MESH, NULL); for ( ; f; f=BMIter_Step(&iter)) { EditVert *v, *lastv=NULL, *firstv=NULL; @@ -141,6 +144,42 @@ /*don't consider two-edged faces*/ if (f->len < 3) continue; + //V_GROW(looptris); + //V_GROW(looptris); + //V_GROW(looptris); + + looptris[i*3] = f->loopbase; + looptris[i*3+1] = f->loopbase->head.next; + looptris[i*3+2] = f->loopbase->head.next->next; + i++; + + if (f->len > 3) { + //V_GROW(looptris); + //V_GROW(looptris); + //V_GROW(looptris); + + looptris[i*3] = f->loopbase; + looptris[i*3+1] = f->loopbase->head.next->next; + looptris[i*3+2] = f->loopbase->head.next->next->next; + i++; + } + + } + + tm->tottri = i; + tm->looptris = looptris; + return; +#endif + + f = BMIter_New(&iter, bm, BM_FACES_OF_MESH, NULL); + for ( ; f; f=BMIter_Step(&iter)) { + EditVert *v, *lastv=NULL, *firstv=NULL; + EditEdge *e; + EditFace *efa; + + /*don't consider two-edged faces*/ + if (f->len < 3) continue; + /*scanfill time*/ l = BMIter_New(&liter, bm, BM_LOOPS_OF_FACE, f); for (j=0; l; l=BMIter_Step(&liter), j++) { @@ -360,7 +399,7 @@ { EditDerivedBMesh *bmdm= (EditDerivedBMesh*) dm; - bmdm_recalc_lookups(bmdm); + //bmdm_recalc_lookups(bmdm); } static void bmDM_foreachMappedVert(DerivedMesh *dm, void (*func)(void *userData, int index, float *co, float *no_f, short *no_s), void *userData) @@ -1463,9 +1502,9 @@ MEM_freeN(bmdm->faceNos); } - BLI_ghash_free(bmdm->fhash, NULL, NULL); - BLI_ghash_free(bmdm->ehash, NULL, NULL); - BLI_ghash_free(bmdm->vhash, NULL, NULL); + if (bmdm->fhash) BLI_ghash_free(bmdm->fhash, NULL, NULL); + if (bmdm->ehash) BLI_ghash_free(bmdm->ehash, NULL, NULL); + if (bmdm->vhash) BLI_ghash_free(bmdm->vhash, NULL, NULL); if (bmdm->vtable) MEM_freeN(bmdm->vtable); if (bmdm->etable) MEM_freeN(bmdm->etable); @@ -1630,7 +1669,7 @@ } } - bmdm_recalc_lookups(bmdm); + //bmdm_recalc_lookups(bmdm); return (DerivedMesh*) bmdm; } Modified: branches/bmesh/blender/source/blender/blenkernel/intern/key.c =================================================================== --- branches/bmesh/blender/source/blender/blenkernel/intern/key.c 2009-09-10 01:14:21 UTC (rev 23098) +++ branches/bmesh/blender/source/blender/blenkernel/intern/key.c 2009-09-10 01:46:52 UTC (rev 23099) @@ -58,6 +58,7 @@ #include "BKE_utildefines.h" #include "BLI_blenlib.h" +#include "BLI_cellalloc.h" #ifdef HAVE_CONFIG_H Modified: branches/bmesh/blender/source/blender/blenkernel/intern/lattice.c =================================================================== --- branches/bmesh/blender/source/blender/blenkernel/intern/lattice.c 2009-09-10 01:14:21 UTC (rev 23098) +++ branches/bmesh/blender/source/blender/blenkernel/intern/lattice.c 2009-09-10 01:46:52 UTC (rev 23099) @@ -40,6 +40,7 @@ #include "BLI_blenlib.h" #include "BLI_arithb.h" +#include "BLI_cellalloc.h" #include "DNA_armature_types.h" #include "DNA_mesh_types.h" Modified: branches/bmesh/blender/source/blender/blenkernel/intern/mesh.c =================================================================== --- branches/bmesh/blender/source/blender/blenkernel/intern/mesh.c 2009-09-10 01:14:21 UTC (rev 23098) +++ branches/bmesh/blender/source/blender/blenkernel/intern/mesh.c 2009-09-10 01:46:52 UTC (rev 23099) @@ -246,7 +246,7 @@ for (i=0; i<copycount; i++){ if (src[i].dw){ - dst[i].dw = MEM_callocN (sizeof(MDeformWeight)*src[i].totweight, "copy_deformWeight"); + dst[i].dw = BLI_cellalloc_calloc (sizeof(MDeformWeight)*src[i].totweight, "copy_deformWeight"); memcpy (dst[i].dw, src[i].dw, sizeof (MDeformWeight)*src[i].totweight); } } Modified: branches/bmesh/blender/source/blender/blenkernel/intern/modifier.c =================================================================== --- branches/bmesh/blender/source/blender/blenkernel/intern/modifier.c 2009-09-10 01:14:21 UTC (rev 23098) +++ branches/bmesh/blender/source/blender/blenkernel/intern/modifier.c 2009-09-10 01:46:52 UTC (rev 23099) @@ -50,6 +50,7 @@ #include "BLI_edgehash.h" #include "BLI_ghash.h" #include "BLI_memarena.h" +#include "BLI_cellalloc.h" #include "MEM_guardedalloc.h" Modified: branches/bmesh/blender/source/blender/blenkernel/intern/modifiers_bmesh.c =================================================================== --- branches/bmesh/blender/source/blender/blenkernel/intern/modifiers_bmesh.c 2009-09-10 01:14:21 UTC (rev 23098) +++ branches/bmesh/blender/source/blender/blenkernel/intern/modifiers_bmesh.c 2009-09-10 01:46:52 UTC (rev 23099) @@ -45,6 +45,7 @@ #include "BLI_edgehash.h" #include "BLI_ghash.h" #include "BLI_memarena.h" +#include "BLI_cellalloc.h" #include "MEM_guardedalloc.h" @@ -288,7 +289,7 @@ int numVerts, numEdges, numFaces; int maxVerts, maxEdges, maxFaces; int finalVerts, finalEdges, finalFaces; - int *indexMap; + int *indexMap = NULL; DerivedMesh *result, *start_cap = NULL, *end_cap = NULL; MVert *src_mvert; @@ -406,7 +407,6 @@ #define _E(s, i) ((BMVert**)(s)->data.buf)[i] -#if 0 /*calculate merge mapping*/ if (j == 0) { BMOperator findop; @@ -444,20 +444,19 @@ BMO_Finish_Op(em->bm, &findop); } -#endif /*generate merge mappping using index map. we do this by using the operator slots as lookup arrays.*/ @@ Diff output truncated at 10240 characters. @@ _______________________________________________ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org http://lists.blender.org/mailman/listinfo/bf-blender-cvs