From: Paul B. <pa...@no...> - 2003-06-27 19:15:00
|
On Friday 27 June 2003 12:05 pm, Erik Schnetter wrote: > On Fri, Jun 27, 2003 at 04:01:03AM +0000, zeng lifang wrote: > > >On Thu, 26 Jun 2003 19:43:42 , Paul wrote: > > >I'd call it a more naive approach. The runtime performance > > > implications of allocating the temporary inside the loop vs. a single > > > block outside are quite severe: > > >- The overhead of the allocation call itself > > > > yes, the overhead of the allocation call is severe. > > The extra overhead can be kept quite small by a method called > "amortized doubling". This used to be widely used in gcc, where it > was called "obstacks". Obstacks should still be available within the > libiberty library, which should still be part of the gcc runtime. <snip> This sounds a good idea in general for our allocation of temporaries. We already use seperate routines for temporary and user allocated memory. Some auditing will be required to check we don't rely on alocating/freeing things in the "wrong" order, but I think we're ok. However I still think allocating a single temporary for a forall is the right way to go, partly because it makes optimization of the more common case (all temporaries the same size) so much simpler. Paul |