On Tue, Aug 24, 2010 at 7:05 AM, Matthias Felleisen <matth...@ccs.neu.edu> wrote: > > Catching up with some mail. > > Neil wrote: > >> Avoiding allocation reduces GC collects, which reduces stutters and hitches. > > My (possibly old) understanding of GC and mutation tell me that this is one > of those prejudices that programmers should get rid of.
In my experience, GC can easily be tuned to take less than 5% or so of the runtime (on average). Optimizing beyond that is most definitely not worth it. A decent generational collector takes almost zero time to deallocate garbage, so allocation of very temporary structure has little penalty. However, allocation of long-lived structure will have a bit more overhead. If that overhead is really a problem (that is, if it takes more than about 10% of your runtime), then the solution is to pre-allocate, or instruct the allocator to put the object in `permanent' storage from the get-go. I'm surprised that racket3m uses page protection. Taking a hardware trap can often be thousands of times slower than taking an inline conditional branch. -- ~jrm _________________________________________________ For list-related administrative tasks: http://lists.racket-lang.org/listinfo/dev