diff --git a/Tools/ftscalingbench/ftscalingbench.py b/Tools/ftscalingbench/ftscalingbench.py index 1a59e25189d5dd..55ec27f9706c34 100644 --- a/Tools/ftscalingbench/ftscalingbench.py +++ b/Tools/ftscalingbench/ftscalingbench.py @@ -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. @@ -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