Path: utzoo!utgpu!news-server.csri.toronto.edu!bonnie.concordia.ca!uunet!zaphod.mps.ohio-state.edu!uakari.primate.wisc.edu!aplcen!jhunix!barrett From: barrett@jhunix.HCF.JHU.EDU (Dan Barrett) Newsgroups: comp.sys.amiga.programmer Subject: Re: How fast/slow is memory DEallocation? Message-ID: <8522@jhunix.HCF.JHU.EDU> Date: 1 Jun 91 00:57:30 GMT References: <8504@jhunix.HCF.JHU.EDU> Organization: The Johns Hopkins University - HCF Lines: 34 In article <8504@jhunix.HCF.JHU.EDU> I wrote: >I have noticed that my [LARGE] data structure is being deallocated extremely >slowly --- almost excruciatingly so. >At first, I thought the problem might be Manx's malloc()/free() >functions, so I switched to AllocMem/FreeMem. This sped things up a bit, >but not much. The problem is solved. Guess what it was?? I forgot to #include , so AllocMem/FreeMem had no prototypes. For some reason, this caused FreeMem to be VERY slow: probably things were being implicitly coerced in a bad way.... Here's a little benchmark to tickle your fancy. This program does several thousand allocate/deallocate calls on a data structure with (appropriately) several thousand nodes. STACK was set to 100,000 just in case. Using AllocMem/FreeMem: run time == 30 seconds Using MANX malloc/free: run time == 5 minutes, 35 seconds Well, I was certainly surprised! Dan //////////////////////////////////////\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\ | Dan Barrett, Department of Computer Science Johns Hopkins University | | INTERNET: barrett@cs.jhu.edu | | | COMPUSERVE: >internet:barrett@cs.jhu.edu | UUCP: barrett@jhunix.UUCP | \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\/////////////////////////////////////