1
0
mirror of https://github.com/samba-team/samba.git synced 2024-12-24 21:34:56 +03:00
samba-mirror/librpc/ndr
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
..
libndr.h ndr: Use resizing array instead of linked lists (breaking ABI) 2017-03-02 08:38:21 +01:00
ndr_auth.c
ndr_auth.h
ndr_backupkey.c s4-backupkey: Initialize ndr->switchlist for print 2015-02-25 01:08:11 +01:00
ndr_backupkey.h
ndr_basic.c Add a new header file for functions in lib/util/util.c. 2016-01-13 04:43:23 +01:00
ndr_bkupblobs.c idl: add nt backup blobs format 2014-10-02 12:02:01 +02:00
ndr_cab.c librpc: cab: Fix ndr_size_cab_file() to detect integer wrap. 2016-12-01 05:53:43 +01:00
ndr_cab.h librpc: Add ndr_cab_get_compression() for Cabinet compression evaluation 2016-11-24 20:24:26 +01:00
ndr_compression.c
ndr_compression.h
ndr_dcerpc.c dcerpc.idl: set LIBNDR_FLAG_* flags based on DCERPC_PFC_FLAG_OBJECT_UUID and DCERPC_DREP_LE 2016-10-26 11:20:18 +02:00
ndr_dcerpc.h dcerpc.idl: hide (ndr->flags & LIBNDR_FLAG_OBJECT_PRESENT) logic behind a define 2014-03-28 08:34:25 +01:00
ndr_dns.c typo: componemt => component 2016-07-05 00:00:15 +02:00
ndr_dns.h
ndr_dnsp.c CVE-2016-2123: Fix DNS vuln ZDI-CAN-3995 2016-12-20 07:51:14 +01:00
ndr_dnsp.h CVE-2016-0771: librpc: add ndr_dnsp_string_list_copy() helper function 2016-03-10 06:52:23 +01:00
ndr_dnsserver.c
ndr_dnsserver.h
ndr_drsblobs.c drsblobs.idl: supplementalCredentialsSubBlob make it possible to parse strange blobs 2016-07-20 21:27:17 +02:00
ndr_drsblobs.h
ndr_drsuapi.c librpc/ndr_drsuapi: Allow ndrdump to dump dsinfo52 blobs 2014-09-27 01:35:36 +02:00
ndr_drsuapi.h
ndr_frsrpc.c
ndr_frsrpc.h
ndr_ioctl.c librpc: Add NETWORK_INTERFACE_INFO IDL data structure 2014-07-24 19:07:06 +02:00
ndr_krb5pac.c krb5pac.idl: implement PAC_UPN_DNS_INFO correct 2016-07-20 21:27:18 +02:00
ndr_krb5pac.h krb5pac: no need for a noprint PAC_BUFFER. 2016-07-20 21:27:18 +02:00
ndr_misc.c librpc/ndr: add ndr_syntax_id_[from|to]_string() 2014-02-11 16:02:14 +01:00
ndr_nbt.c librpc: Fix typos 2015-12-16 04:14:20 +01:00
ndr_nbt.h librpc: add decode_netlogon_samlogon_response_packet for mailslot debugging. 2016-07-01 01:29:42 +02:00
ndr_negoex.c negoex.idl: use DATA_BLOB for negoex_BYTE_VECTOR 2015-12-18 04:07:56 +01:00
ndr_negoex.h negoex.idl: initial version 2015-12-18 01:03:20 +01:00
ndr_netlogon.c
ndr_netlogon.h
ndr_ntlmssp.c librpc/ndr: add ndr_ntlmssp_find_av() helper function 2016-03-10 06:52:29 +01:00
ndr_ntlmssp.h librpc/ndr: add ndr_ntlmssp_find_av() helper function 2016-03-10 06:52:29 +01:00
ndr_ntprinting.c ndr: Pass down string_flags in ndr_pull_ntprinting_printer(). 2013-03-15 12:11:03 +01:00
ndr_ntprinting.h ndr: Add ndr_ntprinting_string_flags() function. 2013-03-15 12:11:02 +01:00
ndr_orpc.c librpc: Fix some "ignored asprint result" warnings 2013-06-11 13:21:12 -07:00
ndr_preg.c
ndr_preg.h
ndr_rap.c
ndr_rap.h
ndr_schannel.c
ndr_schannel.h
ndr_sec_helper.c librpc: Use "all_zero" where appropriate 2017-01-03 16:04:28 +01:00
ndr_spoolss_buf.c spoolss: rename spoolss_EnumPrintProcDataTypes to spoolss_EnumPrintProcessorDataTypes 2016-09-22 12:29:26 +02:00
ndr_spoolss_buf.h spoolss: rename spoolss_EnumPrintProcDataTypes to spoolss_EnumPrintProcessorDataTypes 2016-09-22 12:29:26 +02:00
ndr_string.c librpc/ndr: add ndr_push_charset_to_null and increase library version (abi change) 2017-01-24 10:53:17 +01:00
ndr_svcctl.c
ndr_svcctl.h
ndr_table.c librpc/ndr: add ndr_table_by_syntax() 2014-02-11 16:20:28 +01:00
ndr_table.h librpc/ndr: add ndr_table_by_syntax() 2014-02-11 16:20:28 +01:00
ndr_witness.c librpc:ndr:witness: remove an unneeded block, reducing indentation. 2015-07-07 23:37:04 +02:00
ndr_witness.h witness: autogenerate the marshalling of the witness_notifyResponse_message. 2015-07-03 02:00:27 +02:00
ndr_wmi.c
ndr_wmi.h
ndr_xattr.c
ndr_xattr.h
ndr.c ndr: Use resizing array instead of linked lists (breaking ABI) 2017-03-02 08:38:21 +01:00
util.c
uuid.c librpc/ndr/uuid.c: improve speed and accuracy of GUID string parsing 2016-12-14 08:55:42 +01:00