1
0
mirror of https://github.com/samba-team/samba.git synced 2025-01-13 13:18:06 +03:00
samba-mirror/librpc
Douglas Bagnall 70923b7521 ndr: Use resizing array instead of linked lists (breaking ABI)
The ndr token code keeps a temporary store of tokens which are
referred to a small number of times (often once) before being
discarded. The access patterns are somewhat stack-like, with recently
placed tokens being accessed most often.

The old code kept these tokens in a linked list, which we replace with
a self-resizing array.

This keeps everything roughly the same in big-O terms, but makes it
all faster in practice by vastly reducing the amount of tallocing and
pointer-chasing.

The peak memory use is strictly reduced. On a 64 bit machine each core
token struct fits in 16 bytes (after padding) while the two pointers
used by the DLIST add another 16 bytes, so the overall list allocation
is the same as the peak 2n array allocation -- except in the list case
it is dwarfed by the talloc and malloc metadata overhead.

Before settling on the resized arrays, we tried red-black trees, which
are bound to be better for large ndr structures. As it happens, we
don't deal with large structures (the size of replication clumps is
limited to 400 objects) and the asymptotic benefits of the trees are
not realised in practice.

With luck you should find graphs comparing the performance of these
various techniques at:

https://www.samba.org/~dbagnall/perf-tests/ndr-token/

This necessarily breaks the ABI because the linked list implementation
was publicly exposed.

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>

Autobuild-User(master): Andrew Bartlett <abartlet@samba.org>
Autobuild-Date(master): Thu Mar  2 08:38:22 CET 2017 on sn-devel-144
2017-03-02 08:38:21 +01:00
..
ABI ndr: Use resizing array instead of linked lists (breaking ABI) 2017-03-02 08:38:21 +01:00
gen_ndr waf-idl: put the gen_ndr/README file for source3 back 2010-07-19 22:17:17 +10:00
idl drsuapi.idl: make drsuapi_DsGetNCChangesRequest10 [public] 2017-02-08 23:20:18 +01:00
ndr ndr: Use resizing array instead of linked lists (breaking ABI) 2017-03-02 08:38:21 +01:00
rpc librpc/rpc: fix regression in NT_STATUS_RPC_ENUM_VALUE_OUT_OF_RANGE error mapping 2017-02-21 16:09:21 +01:00
tools ndrdump: Fix a possible NULL pointer dereference 2017-02-23 03:18:10 +01:00
ndr_krb5pac.pc.in pkgconfig: Do not hardcode library version numbers in pc files. 2013-08-22 20:48:44 +02:00
ndr_nbt.pc.in pkgconfig: Do not hardcode library version numbers in pc files. 2013-08-22 20:48:44 +02:00
ndr_standard.pc.in pkgconfig: Do not hardcode library version numbers in pc files. 2013-08-22 20:48:44 +02:00
ndr.pc.in pkgconfig: Do not hardcode library version numbers in pc files. 2013-08-22 20:48:44 +02:00
tables.pl Consider shared IDL files and Samba3-specific IDL files separately, allow overriding output directory. 2008-12-16 15:42:47 +01:00
wscript_build ndr: Use resizing array instead of linked lists (breaking ABI) 2017-03-02 08:38:21 +01:00