FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

gh-132657: Add free-threading scaling benchmark for copy.copy and copy.deepcopy by eendebakpt · Pull Request #132658 · python/cpython · GitHub

/ cpython Public
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension .py  (1) All 1 file type selected
Viewed files
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Unified
Split
Hide whitespace
Diff view
Unified
Split
Hide whitespace
15 changes: 14 additions & 1 deletion Tools/ftscalingbench/ftscalingbench.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
# > echo "0" | sudo tee /sys/devices/system/cpu/cpufreq/boost
#

import copy
import math
import os
import queue
Expand All @@ -39,11 +40,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

Back | FazBrowse Home | New Git URL