1
0
mirror of https://github.com/samba-team/samba.git synced 2024-12-23 17:34:34 +03:00
samba-mirror/librpc/ABI
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
..
ndr-0.0.1.sigs ndr: Update ABI. 2012-03-26 19:58:25 +02:00
ndr-0.0.2.sigs librpc: Add NDR_PRINT_DEBUGC to ndr print to a debug class 2013-05-18 10:58:05 +02:00
ndr-0.0.3.sigs librpc/ndr: add ndr_syntax_id_[from|to]_string() 2014-02-11 16:02:14 +01:00
ndr-0.0.4.sigs Create talloc-less functions for formating GUID 2014-10-02 12:02:01 +02:00
ndr-0.0.5.sigs librpc/ndr: add ndr_{pull|push|print}_HRESULT and release new 0.0.5 ABI. 2015-03-13 23:58:07 +01:00
ndr-0.0.6.sigs librpc ndr: add ndr_pull_steal_switch_value() 2016-03-22 08:00:31 +01:00
ndr-0.0.7.sigs libndr: Add ndr_pull_struct_blob_all_noalloc 2016-05-03 08:10:10 +02:00
ndr-0.0.8.sigs librpc: Add ndr_push_struct_into_fixed_blob() and use it in GUID_to_ndr_blob() 2016-07-28 10:06:12 +02:00
ndr-0.0.9.sigs librpc/ndr: add ndr_push_charset_to_null and increase library version (abi change) 2017-01-24 10:53:17 +01:00
ndr-0.1.0.sigs ndr: Use resizing array instead of linked lists (breaking ABI) 2017-03-02 08:38:21 +01:00