talloc vs malloc speed
Andreas Schneider
asn at samba.org
Fri Apr 14 18:11:46 UTC 2023
Hi,
Florian Weimer implemented hwcaps support in glibc. This allows you to drop
optimized libraries.
The support for this is enabled in openSUSE Tumbleweed right now [1]. I've
enabled it for libtalloc as you want to to be as fast as possible.
Here are the results from my AMD Ryzen 9 3900X 12-Core processor.
talloc x86_64_v1 (testsuite compiled with -O0)
test: speed
# TALLOC VS MALLOC SPEED
talloc: 46623469 ops/sec
talloc_pool: 74121933 ops/sec
malloc: 66443400 ops/sec
success: speed
=> talloc is 30% slower
talloc x86_64_v3 (testsuite compiled with -O0)
test: speed
# TALLOC VS MALLOC SPEED
talloc: 47783809 ops/sec
talloc_pool: 75068595 ops/sec
malloc: 68073710 ops/sec
success: speed
=> talloc is 30% slower
talloc x86_64_v3 (testsuite compiled with -O2)
test: speed
# TALLOC VS MALLOC SPEED
talloc: 50633005 ops/sec
talloc_pool: 74245533 ops/sec
malloc: 219259200 ops/sec
success: speed
=> talloc is 77% slower
It looks like the optimizer is able to optimize the code a lot more if malloc
is used.
I wonder if it would be possible to give the optimizer more hints. Maybe
Florian has some ideas :-)
Best regards
Andreas
P.S. The talloc website states it is 4% slower than malloc. This was probably
a long long time ago ;-)
[1] https://www.phoronix.com/news/glibc-hwcaps-RFC
[2] https://news.opensuse.org/2023/03/02/tw-gains-optional-optimizations/
--
Andreas Schneider asn at samba.org
Samba Team www.samba.org
GPG-ID: 8DFF53E18F2ABC8D8F3C92237EE0FC4DCC014E3D
More information about the samba-technical
mailing list