[comp.unix.xenix] 386 malloc with huge programs

amys@sco.COM (amy snader) (07/24/88)

Here's a hint for all of you out there who are running 
BIG programs on the '386, especially those large enough
to cause the system to page: 

	If your huge application does many small malloc()'s
	(as opposed to a couple of big malloc()'s, compiling
	your application with -lmalloc can be a tremendous
	performance win.

This is a "try it and see" sort of thing. 
For both small applications and for big applications that 
allocate their memory all in one chunk,
normal malloc is less overhead. 
But when -lmalloc wins, it really wins.  I have an
(admittedly contrived) test program that runs in 1/50th
the time with -lmalloc.
 
The explanation has to do with which pages have to be
faulted in to manage malloc()'s freelist.  I suspect
this may be helpful in running pathalias on the 386. 

(To JFH -- no, there is no difference
in how a growing process is paged vs. one whose size
is static).
		--Amy  (sco!abs)