-malign-double
Jed Brown
jed at 59A2.org
Mon Nov 16 14:59:40 CST 2009
Jed Brown wrote:
> malloc4 1000000 loops in 1412541359 cycles, average 1412.541359
> malloc1 1000000 loops in 298137728 cycles, average 298.137728
>
> If there is an extra allocation between malloc and free, we get
>
> malloc4 1000000 loops in 1667959560 cycles, average 1667.959560
> malloc1 1000000 loops in 538137819 cycles, average 538.137819
>
> Clearly glibc is optimized for freeing the very last thing allocated.
I should elaborate. What I had actually done is to do an extra
malloc/free on every other iteration. So 596 cycles for two
malloc/frees in two iterations, 1076 for three malloc/frees in two
iterations, suggesting that this extra malloc/free costs significantly
more than the one on top of the stack. That should explain why 4 per
loop takes more than 4 times as long as 1 per loop.
Jed
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 261 bytes
Desc: OpenPGP digital signature
URL: <http://lists.mcs.anl.gov/pipermail/petsc-dev/attachments/20091116/920c644f/attachment.sig>
More information about the petsc-dev
mailing list