Skip to content
Open
Changes from all commits
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
15 changes: 14 additions & 1 deletion 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
import copy
from operator import methodcaller

# The iterations in individual benchmarks are scaled by this factor.
Expand All @@ -38,11 +39,23 @@
in_queues = []
out_queues = []


def register_benchmark(func):
ALL_BENCHMARKS[func.__name__] = func
return func


@register_benchmark
def shallow_copy():
x = [1, 2, 3]
for i in range(200 * WORK_SCALE):
copy.copy(x)

@register_benchmark
def deepcopy():
x = {'list': [1, 2], 'tuple': (1, None)}
for i in range(40 * WORK_SCALE):
copy.deepcopy(x)

@register_benchmark
def object_cfunction():
accu = 0
Expand Down
Loading