Skip to content

Commit 5ef77af

Browse files
committed
Add deepcopy benchmark to ftscalingbench.
This is taken from the PR GH-132658.
1 parent 03977d9 commit 5ef77af

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

Tools/ftscalingbench/ftscalingbench.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
# > echo "0" | sudo tee /sys/devices/system/cpu/cpufreq/boost
2222
#
2323

24+
import copy
2425
import math
2526
import os
2627
import queue
@@ -214,6 +215,14 @@ def instantiate_dataclass():
214215
for _ in range(1000 * WORK_SCALE):
215216
obj = MyDataClass(x=1, y=2, z=3)
216217

218+
219+
@register_benchmark
220+
def deepcopy():
221+
x = {'list': [1, 2], 'tuple': (1, None)}
222+
for i in range(40 * WORK_SCALE):
223+
copy.deepcopy(x)
224+
225+
217226
def bench_one_thread(func):
218227
t0 = time.perf_counter_ns()
219228
func()

0 commit comments

Comments
 (0)