Date: Wed, 12 Apr 1995 14:34:05 +0300 From: Kai Vorma <vode@snakemail.hut.fi> To: Nate Williams <nate@trout.sri.MT.net> Cc: hackers@FreeBSD.org Subject: Re: A better malloc() for FreeBSD Message-ID: <199504121134.OAA24547@vinkku.hut.fi> In-Reply-To: <199504111955.NAA10123@trout.sri.MT.net> References: <vode@snakemail.hut.fi> <199504111955.NAA10123@trout.sri.MT.net>
next in thread | previous in thread | raw e-mail | index | archive | help
Nate Williams writes:
 > 
 > I'm in agreement with you.  The current malloc implementation is very
 > fast, but I think replacing malloc would make the system faster since
 > there would be less swapping due to less memory use.
 > 
 > If you could get some hard numbers re: performance I think we might have
 > more to stand on when the time comes to integrate it into the system.
Here you have some numbers. I think all mallocs are fast enough
although dlmalloc is superior in simumalloc/1.
..vode
---------------------------------------------------------------------------
Test machine: 486DX/2 66, 256cache, 16MB RAM, FreeBSD-2.1D
mtest.c
  for (i = 0; i < 1000000; i++) {
    p1 = malloc(20);
    p2 = malloc(2048);
    p3 = malloc(100000);
    free (p2);
    free (p1);
    p4 = malloc(100);
    free (p4);
    free (p3);
  }
25.093s real  24.981s user  0.039s system  99% ./mtest.csri
25.103s real  24.957s user  0.031s system  99% ./mtest.csri
25.147s real  25.019s user  0.054s system  99% ./mtest.csri
12.709s real  12.647s user  0.054s system  99% ./mtest.BSD
12.753s real  12.668s user  0.023s system  99% ./mtest.BSD
12.755s real  12.647s user  0.054s system  99% ./mtest.BSD
12.095s real  11.953s user  0.062s system  99% ./mtest.dl
12.067s real  11.990s user  0.031s system  99% ./mtest.dl
12.136s real  12.025s user  0.054s system  99% ./mtest.dl
---------------------------------------------------------------------------
simumalloc.c (from CSRI-malloc distribution) - basically does
for i (1 .. t) {
  malloc (rnd(s) * sizeof(word))
  freeall(l) /* free all blocks whose lifetime has been expired */
}
1  simumalloc -t 200000 -s 512 -l 20000
2  simumalloc -t 200000 -s 512 -l 10000
3  simumalloc -t 200000 -s 512 -l 2000
4  simumalloc -t 200000 -s 512 -l 500
5  simumalloc -t 200000 -s 512 -l 20
6  simumalloc -t 200000 -s 512 -l 2
7  simumalloc -t 5000 -s 512 -a
8  simumalloc -t 200000 -s 4096 -l 500
9  simumalloc -t 200000 -s 4096 -l 2000
BSD-malloc
1 [ interrupted after 25 minutes of constant paging.. ]
2  Sbrked 7386044,  MaxAlloced 5292552, Wastage 0.28
   3.851s real  3.087s user  0.670s system  97%
3  Sbrked 1614780,  MaxAlloced 1108524, Wastage 0.31
   3.129s real  2.893s user  0.218s system  99%
4  Sbrked 467900,   MaxAlloced 309384,  Wastage 0.34
   3.010s real  2.876s user  0.125s system  99%
5  Sbrked 78780,    MaxAlloced 26176,   Wastage 0.67
   2.603s real  2.463s user  0.132s system  99%
6  Sbrked 46012,    MaxAlloced 5756,    Wastage 0.87
   2.454s real  2.359s user  0.078s system  99%
7  Sbrked 6988732,  MaxAlloced 5140464, Wastage 0.26
   0.701s real  0.116s user  0.551s system  95%
8  Sbrked 4174780,  MaxAlloced 2492676, Wastage 0.40
   3.247s real  2.933s user  0.313s system  99%
CSRI-malloc
1 [ interrupted after 25 minutes of constant paging.. ]
2  Sbrked 5935352,  MaxAlloced 5292552, Wastage 0.11
   12.862s real  12.168s user  0.632s system  99%
3  Sbrked 1246096,  MaxAlloced 1108524, Wastage 0.11
   5.007s real  4.758s user  0.210s system  99%
4  Sbrked 352514,   MaxAlloced 309384,  Wastage 0.12
   3.940s real  3.760s user  0.163s system  99%
5  Sbrked 28693,    MaxAlloced 26176,   Wastage 0.09
   3.197s real  3.072s user  0.109s system  99%
6  Sbrked 8198,     MaxAlloced 5756,    Wastage 0.30
  3.272s real  3.178s user  0.078s system  99%
7  Sbrked 5181136,  MaxAlloced 5140464, Wastage 0.01
   0.586s real  0.179s user  0.381s system  95%
8  Sbrked 2966116,  MaxAlloced 2492676, Wastage 0.16
   4.293s real  3.987s user  0.289s system  99%
9  Sbrked 10758352,  MaxAlloced 8960644, Wastage 0.17
   12.868s real  5.871s user  1.083s system  54%
Doug Lea's malloc
1  Sbrked 11018240,  MaxAlloced 10470000, Wastage 0.05
   133.908s real  5.964s user  2.417s system  6%
2  Sbrked 5619712,  MaxAlloced 5292552, Wastage 0.06
   4.279s real  3.833s user  0.445s system  99%
3  Sbrked 1245184,  MaxAlloced 1108524, Wastage 0.11
   3.633s real  3.420s user  0.195s system  99%
4  Sbrked 368640,   MaxAlloced 309384,  Wastage 0.16
   3.439s real  3.304s user  0.124s system  99%
5  Sbrked 32768,    MaxAlloced 26176,   Wastage 0.20
   3.964s real  3.836s user  0.093s system  99%
6  Sbrked 8192,     MaxAlloced 5756,    Wastage 0.30
   3.990s real  3.860s user  0.116s system  99%
7  Sbrked 5193728,  MaxAlloced 5140464, Wastage 0.01
   0.590s real  0.143s user  0.413s system  94%
8  Sbrked 2891776,  MaxAlloced 2492676, Wastage 0.14
   5.077s real  4.779s user  0.288s system  99%
9  Sbrked 9953280,  MaxAlloced 8960644, Wastage 0.10
   10.273s real  6.048s user  0.864s system  67%
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199504121134.OAA24547>
