[PATCH] Improve talloc performance

Andrew Bartlett abartlet at samba.org
Fri Jun 17 09:50:27 UTC 2016


Attached is a patch to improve talloc performance, by calling
talloc_chunk_from_ptr() less often.  I'm impressed by how much can be
gained!  

Please carefully review!

Below are the timings on my laptop, 3 runs for with these patches, with
master, and with master before my talloc_magic protections, which
clearly didn't have a performance cost.  This was a normal developer
build.

patched:
# TALLOC VS MALLOC SPEED
talloc: 8437163 ops/sec
talloc_pool: 10395363 ops/sec
malloc: 23325789 ops/sec
success: speed

# TALLOC VS MALLOC SPEED
talloc: 8764234 ops/sec
talloc_pool: 11426548 ops/sec
malloc: 23068823 ops/sec
success: speed

# TALLOC VS MALLOC SPEED
talloc: 8842149 ops/sec
talloc_pool: 11550205 ops/sec
malloc: 24646425 ops/sec
success: speed

master:
# TALLOC VS MALLOC SPEED
talloc: 7656914 ops/sec
talloc_pool: 10140509 ops/sec
malloc: 24302308 ops/sec
success: speed

# TALLOC VS MALLOC SPEED
talloc: 8004550 ops/sec
talloc_pool: 9969797 ops/sec
malloc: 24658161 ops/sec
success: speed
test: autofree

# TALLOC VS MALLOC SPEED
talloc: 7778159 ops/sec
talloc_pool: 9511501 ops/sec
malloc: 24578612 ops/sec
success: speed
test: autofree

before talloc_magic protection:
# TALLOC VS MALLOC SPEED
talloc: 7406886 ops/sec
talloc_pool: 9963002 ops/sec
malloc: 21778295 ops/sec
success: speed

# TALLOC VS MALLOC SPEED
talloc: 7756519 ops/sec
talloc_pool: 9273524 ops/sec
malloc: 22667255 ops/sec

# TALLOC VS MALLOC SPEED
talloc: 8114818 ops/sec
talloc_pool: 10066840 ops/sec
malloc: 24404756 ops/sec
success: speed
test: autofree

-- 
Andrew Bartlett                       http://samba.org/~abartlet/
Authentication Developer, Samba Team  http://samba.org
Samba Developer, Catalyst IT          http://catalyst.net.nz/services/samba


-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-talloc-Call-talloc_chunk_from_ptr-less-often-in-_tal.patch
Type: text/x-patch
Size: 9850 bytes
Desc: not available
URL: <http://lists.samba.org/pipermail/samba-technical/attachments/20160617/191e7ed2/0001-talloc-Call-talloc_chunk_from_ptr-less-often-in-_tal.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0002-talloc-Call-talloc_chunk_from_ptr-less-often-in-__ta.patch
Type: text/x-patch
Size: 1797 bytes
Desc: not available
URL: <http://lists.samba.org/pipermail/samba-technical/attachments/20160617/191e7ed2/0002-talloc-Call-talloc_chunk_from_ptr-less-often-in-__ta.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0003-talloc-Do-not-call-talloc_chunk_from_ptr-on-known-ch.patch
Type: text/x-patch
Size: 4749 bytes
Desc: not available
URL: <http://lists.samba.org/pipermail/samba-technical/attachments/20160617/191e7ed2/0003-talloc-Do-not-call-talloc_chunk_from_ptr-on-known-ch.bin>


More information about the samba-technical mailing list