aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/Tools/ftscalingbench/ftscalingbench.py
diff options
context:
space:
mode:
Diffstat (limited to 'Tools/ftscalingbench/ftscalingbench.py')
-rw-r--r--Tools/ftscalingbench/ftscalingbench.py13
1 files changed, 13 insertions, 0 deletions
diff --git a/Tools/ftscalingbench/ftscalingbench.py b/Tools/ftscalingbench/ftscalingbench.py
index 926bc66b944..1a59e25189d 100644
--- a/Tools/ftscalingbench/ftscalingbench.py
+++ b/Tools/ftscalingbench/ftscalingbench.py
@@ -27,6 +27,7 @@ import queue
import sys
import threading
import time
+from operator import methodcaller
# The iterations in individual benchmarks are scaled by this factor.
WORK_SCALE = 100
@@ -188,6 +189,18 @@ def thread_local_read():
_ = tmp.x
_ = tmp.x
+class MyClass:
+ __slots__ = ()
+
+ def func(self):
+ pass
+
+@register_benchmark
+def method_caller():
+ mc = methodcaller("func")
+ obj = MyClass()
+ for i in range(1000 * WORK_SCALE):
+ mc(obj)
def bench_one_thread(func):
t0 = time.perf_counter_ns()