[prev in list] [next in list] [prev in thread] [next in thread] 

List:       coreutils
Subject:    [coreutils] MALLOC_PERTURB_ and benchmarking
From:       Pádraig Brady <P () draigBrady ! com>
Date:       2010-07-28 10:11:23
Message-ID: 4C50024B.6060609 () draigBrady ! com
[Download RAW message or body]

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.


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic