NetBSD-Bugs archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: lib/50791: NetBSD's malloc has performance issues



The following reply was made to PR lib/50791; it has been noted by GNATS.

From: Onno van der Linden <o.vd.linden%quicknet.nl@localhost>
To: gnats-bugs%netbsd.org@localhost
Cc: 
Subject: Re: lib/50791: NetBSD's malloc has performance issues
Date: Fri, 19 Feb 2016 16:50:06 +0100

 >  I somehow doubt that it makes a big difference. The provided trace is
 >  somewhat atypical as roughly half of the allocations is between 64KB and
 >  256KB. For jemalloc, that's a large allocation, so chunks out of the
 >  larger 1MB blocks are allocated for it. What happens is that we are
 >  using a single arena in either the single threaded or always running on
 >  the same CPU case. The search of for the next free run of enough pages
 >  is done in chunk address order, so the most of the allocations
 >  process have to process most of the chunks. Keeping the chunk tree
 >  ordered by the estimated number size of the largest run avoids this
 >  worst case at the cost of shuffling things around a bit more often. A
 >  proof of concept is attached. I haven't done any exhaustive testing for
 >  this...
 
 FWIW,
 
 jemalloc.c with the provided patch and the original test program:
 
 $ cc -I/usr/src/lib/libc/include  mtest.c jemalloc.c
 $ time ./a.out
     0.19s real     0.17s user     0.01s system
 $ time ./a.out 
     0.18s real     0.15s user     0.03s system
 $ time ./a.out 
     0.19s real     0.16s user     0.03s system
 $ time ./a.out 
     0.19s real     0.14s user     0.05s system
 $ time ./a.out 
     0.19s real     0.15s user     0.04s system
 $ time ./a.out 
     0.19s real     0.14s user     0.06s system
 
 
 Onno
 


Home | Main Index | Thread Index | Old Index