Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
add method_caller benchmark to ftscalingbench.py
  • Loading branch information
kumaraditya303 committed May 23, 2025
commit 1d0a0b904837e5d30cb651ed357062a9f068561d
13 changes: 13 additions & 0 deletions Tools/ftscalingbench/ftscalingbench.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
import sys
import threading
import time
from operator import methodcaller

# The iterations in individual benchmarks are scaled by this factor.
WORK_SCALE = 100
Expand Down Expand Up @@ -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()
Expand Down
Loading