|
Magic Mailing List |
|
From: Conrad H Ziesler (cziesler AT eecs DOT umich.edu) Date: Tue May 14 2002 - 15:17:37 EDT
performance bug:
loading a file containing even a modest number (5000) of subcell calls
with invalid timestamps takes > 2 hours on PII/300MHz
after the patch: ~10 seconds.
the problem is that magic was repeatedly loading and computing the
bounding box of each subcell, the fix just sets a flag to indicate this
computation is done.
patch to database/database.h database/DBtimestmp.c
this also fixes a use after free memory allocation bug.
--conrad
*** magic-7.1.5/database/database.h Wed Feb 27 11:22:26 2002
--- local/database/database.h Sun May 12 18:00:20 2002
***************
*** 288,293 ****
--- 288,295 ----
#define CDNOEDIT 0200
#endif
+ #define CDPROCESSED 0400
+
/*
* Description of an array.
* The bounds xlo .. xhi and ylo .. yhi are transformed versions
*** magic-7.1.5/database/DBtimestmp.c Wed Nov 28 14:23:34 2001
--- local/database/DBtimestmp.c Sun May 12 18:08:06 2002
***************
*** 109,115 ****
Rect oldArea, parentArea, tmp;
int redisplay;
int firstOne = TRUE;
!
/* It's very important to disable interrupts during this section!
* Otherwise, we may not paint the recheck tiles properly.
*/
--- 109,116 ----
Rect oldArea, parentArea, tmp;
int redisplay;
int firstOne = TRUE;
! void *tofree;
! Mismatch *tmpm;
/* It's very important to disable interrupts during this section!
* Otherwise, we may not paint the recheck tiles properly.
*/
***************
*** 118,123 ****
--- 119,129 ----
if (mismatch == NULL) return;
TxPrintf("Processing timestamp mismatches:");
SigDisableInterrupts();
+ for(tmpm=mismatch;tmpm!=NULL;tmpm=tmpm->mm_next)
+ {
+ tmpm->mm_cellDef->cd_flags&=(~CDPROCESSED);
+ }
+
while (mismatch != NULL)
{
/* Be careful to remove the front element from the mismatch
***************
*** 127,134 ****
cellDef = mismatch->mm_cellDef;
oldArea = mismatch->mm_oldArea;
! FREE((char *) mismatch);
mismatch = mismatch->mm_next;
(void) DBCellRead(cellDef, (char *) NULL, TRUE);
/* Jimmy up the cell's current bounding box, so the following
--- 133,144 ----
cellDef = mismatch->mm_cellDef;
oldArea = mismatch->mm_oldArea;
! tofree=mismatch;
mismatch = mismatch->mm_next;
+ FREE((char *) tofree);
+
+ if( ((cellDef->cd_flags)&(CDPROCESSED))==0)
+ {
(void) DBCellRead(cellDef, (char *) NULL, TRUE);
/* Jimmy up the cell's current bounding box, so the following
***************
*** 168,174 ****
--- 178,187 ----
}
else TxPrintf(", %s", cellDef->cd_name);
TxFlush(); /* This is needed to prevent _doprnt screwups */
+ cellDef->cd_flags|=CDPROCESSED;
+ }
}
+
SigEnableInterrupts();
TxPrintf(".\n");
TxFlush();
***************
*** 274,279 ****
--- 287,293 ----
mm->mm_oldArea = *wrongArea;
mm->mm_next = mismatch;
mismatch = mm;
+ cellDef->cd_flags&=(~CDPROCESSED);
for (parentUse = cellDef->cd_parents; parentUse != NULL;
parentUse = parentUse->cu_nextuse)
|
|
|
|