coreutils
[Top][All Lists]
Advanced

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

[coreutils] MALLOC_PERTURB_ and benchmarking


From: Pádraig Brady
Subject: [coreutils] MALLOC_PERTURB_ and benchmarking
Date: Wed, 28 Jul 2010 11:11:23 +0100
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.1.8) Gecko/20100227 Thunderbird/3.0.3

This is just a note to disable MALLOC_PERTURB_ when benchmarking anything.
I forgot and was surprised for a while with sort's slow startup
as it malloc()s a large buffer by default.

$ free -m
             total       used       free     shared    buffers     cached
Mem:          2006       1143        863          0        163        734

$ ltrace -e malloc ./sort </dev/null
malloc(26214432)                                 = 0xb5c41008

$ time for i in $(seq 100); do MALLOC_PERTURB_=42 ./sort < /dev/null ; done
real    0m4.894s
user    0m0.516s
sys     0m4.305s

$ time for i in $(seq 100); do MALLOC_PERTURB_= ./sort < /dev/null ; done
real    0m0.142s
user    0m0.047s
sys     0m0.095s

$ time for i in $(seq 100); do MALLOC_PERTURB_=42 ./sort -S1M < /dev/null ; done
real    0m0.284s
user    0m0.064s
sys     0m0.219s

There is the argument that the sort buffer size
should be more tuned to cache size than mem size,
but that's for another day:
http://lists.gnu.org/archive/html/bug-coreutils/2010-03/msg00008.html

cheers,
Pádraig.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]