]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
perftest:ndr_pack: slightly reduce python overhead
authorDouglas Bagnall <douglas.bagnall@catalyst.net.nz>
Tue, 2 Jan 2024 20:43:01 +0000 (09:43 +1300)
committerAndrew Bartlett <abartlet@samba.org>
Thu, 8 Feb 2024 02:48:44 +0000 (02:48 +0000)
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

source4/dsdb/tests/python/ndr_pack_performance.py

index 0ff03a27f21bf775331345ced340316b60238dbb..083abf6621f489821304b75f26f89bb45867d9e9 100644 (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)