Skip to content
Open
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
17 changes: 16 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

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


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


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

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

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