commit c9cf90aee864d8131dc386d61f3e35602c2ed63c Date: Thu Sep 14 18:24:36 2023 +1200 s3-lib/util_nttoken: Reimplement dup_nt_token() with NDR pull/push The above commit replaces memcpy with ndr pull, and also uses ndr push, which seem to be more expensive. With this commit, SpecFS DB benchmarks showed performance degradation only at higher loads, on our filesystem. With the revert of this commit, numbers became normal like found with SMB 4.19 based code. Also some approximate profiling using clock() gave timings as below. Old Code talloc_zero - 0.001000 ms memdup section - if (ptoken->sids && ptoken->num_sids) { token->sids = (struct dom_sid *)talloc_memdup(.....); } - 0.002000 ms New Code with NDR pull/push talloc_zero - 0.002000 ms frame = talloc_stackframe(); - 0.002000 ms ndr_push_struct_blob - 0.018000 ms ndr_pull_struct_blob - 0.009000 ms
We could probably add a shortcut in the `if (src->num_local_claims == 0 && src->num_user_claims == 0 && src->num_device_claims == 0)` case.