Enhancing malloc
Ondřej Bílka
neleai@seznam.cz
Tue May 28 13:03:00 GMT 2013
On Tue, May 28, 2013 at 06:24:44PM +0530, Siddhesh Poyarekar wrote:
> On Tue, May 28, 2013 at 02:33:17PM +0200, OndÅej BÃlka wrote:
> > Malloc and friends are one of few libc functions which can be measured
> > directly. They account to about 50% of time spend in libc. I know that gcc
> > hevavily uses malloc. So authoritative test could be if following is
> > improvement or not:
> >
> > for I in `seq 1 10` do
> > echo new
> > LD_PRELOAD=new_malloc.so time gcc test.c
> > echo old
> > time gcc test.c
> > done
> >
> > You must take into account that malloc requests are small. I did some
> > measurements at
> > http://kam.mff.cuni.cz/~ondra/benchmark_string/malloc_profile_28_11_2012.tar.bz2
>
> For malloc and friends, the comparison should also include the effect
> of the change on fragmentation (internal as well as external) and not
> just speed of execution.
>
This depends if you use bash time builtin or /usr/bin/time.
Later has all information needed (but better formating than default is
welcome, see below.)
Ondra
$ /usr/bin/time gcc test.c
0.06user 0.06system
0:00.13elapsed 94%CPU (0avgtext+0avgdata 36560maxresident)k
0inputs+16outputs (0major+6296minor)pagefaults 0swaps
More information about the Libc-alpha
mailing list