1
0
mirror of https://github.com/samba-team/samba.git synced 2025-01-10 01:18:15 +03:00

perftest:ndr_pack: slightly reduce python overhead

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
BUG: https://bugzilla.samba.org/show_bug.cgi?id=15574
This commit is contained in:
Douglas Bagnall 2024-01-03 09:43:01 +13:00 committed by Andrew Bartlett
parent e802611743
commit d25fe2447b

View File

@ -172,16 +172,16 @@ class UserTests(samba.tests.TestCase):
pass
def _test_pack(self, unpacked, cycles=10000):
pack = unpacked.__ndr_pack__
for i in range(SCALE * cycles):
ndr_pack(unpacked)
pack()
def _test_unpack(self, blob, cycles=10000, cls=security.descriptor):
for i in range(SCALE * cycles):
ndr_unpack(cls, blob)
cls().__ndr_unpack__(blob)
def _test_pack_unpack(self, desc, cycles=5000, cls=security.descriptor):
blob2 = ndr_pack(desc)
for i in range(SCALE * cycles):
blob = ndr_pack(desc)
desc = ndr_unpack(cls, blob)