We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent f9d2f28 commit 1d0a0b9Copy full SHA for 1d0a0b9
Tools/ftscalingbench/ftscalingbench.py
@@ -27,6 +27,7 @@
27
import sys
28
import threading
29
import time
30
+from operator import methodcaller
31
32
# The iterations in individual benchmarks are scaled by this factor.
33
WORK_SCALE = 100
@@ -188,6 +189,18 @@ def thread_local_read():
188
189
_ = tmp.x
190
191
192
+class MyClass:
193
+ __slots__ = ()
194
+
195
+ def func(self):
196
+ pass
197
198
+@register_benchmark
199
+def method_caller():
200
+ mc = methodcaller("func")
201
+ obj = MyClass()
202
+ for i in range(1000 * WORK_SCALE):
203
+ mc(obj)
204
205
def bench_one_thread(func):
206
t0 = time.perf_counter_ns()
0 commit comments