On 2010-09-29,
<> wrote:
> I have a question on how the size of memory malloc'd affects the
> performance of a program. For example, comparing malloc-ing 100 bytes
> vs 500 bytes of memory, and calling the malloc 80,000,000 times, is
> the former faster than the latter since it allocates a smaller memory
> block?
Answer: Maybe. One might be faster than the other, or maybe not.
It's not going to be consistent enough for long enough to justify thinking
about it for most real-world cases. Normally when I've seen big shifts in
behavior, they've come up at sizes measured in tens of megabytes; for
instance, one implementation I use switches to a different kind of allocation
entirely at 64-128MB or so.
-s
--
Copyright 2010, all wrongs reversed. Peter Seebach /
usenet-
http://www.seebs.net/log/ <-- lawsuits, religion, and funny pictures
http://en.wikipedia.org/wiki/Fair_Game_(Scientology) <-- get educated!
I am not speaking for my employer, although they do rent some of my opinions.