[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: following up on speed
>Actually, I think it would be fair. In my experience, many C/C++ coders
>don't seem to think too much about allocation issues.
Well, OK. One must be careful about exactly what one is trying to
measure and what
question one is trying to answer.
>One of the benefits of scheme (and friends) is that the system takes
>care of memory allocation/deallocation for you, adapting to the
>program's dynamic allocation patterns. While a good malloc
>implementation will do OK for an average program, it is rarely optimal.
>In theory, a good C coder can tune their malloc implementation to match
>their application's allocation behavior (dramatically improving
>performance), but in practice this doesn't usually happen. One reason is
>that malloc tuning involves custom recompiling of glibc (which is a
>pain), and some knowledge about how allocators actually work. If you're
>convinced that malloc and free take zero time (like those folks yelling
>at java evangelists), then you're probably missing the knowledge part.
In C++ it's a lot easier to customize allocation and freeing. You don't
have to get in at the
level of the runtime library because there is a per-class hook.
>Given the infrequency of malloc replacement and tuning, I'd suggest that
>it's a perfectly fair comparison to compare glibc's standard allocator
>against a modern and widely used scheme (say PLT scheme for example).
It's fair depending on what question you're asking. Some people would be
a lot more
interested in a comparision between the Solaris runtime library's malloc
and the GC
that comes with the standard Java J2SE distribution from Sun, just to
pick one of
thousands of possible comparisons one might run. But if you're
comparing things in
two different languages, you have added many, many jokers to the mix. If
interested in the ultimate question of whether today's GC's are
faster/slower than today's
mallocs, it might be better to keep it all in C, and use the best C GC
you can find.
What is "fair" depends so much on what you're really trying to learn.