Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

gh-132657: Add free-threading scaling benchmark for copy.copy and copy.deepcopy #132658

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: main
Choose a base branch
Loading
from
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
Next Next commit
Add free-threading scaling bm
  • Loading branch information
eendebakpt committed Apr 17, 2025
commit b2fb5ec595c3546674bb88e5439006ffc79d7371
17 changes: 16 additions & 1 deletion 17 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)
eendebakpt marked this conversation as resolved.
Show resolved Hide resolved

@register_benchmark
def deepcopy():
x = {'list': [1, 2], 'tuple': (1, None)}
deepcopy = copy.deepcopy
for i in range(40 * WORK_SCALE):
deepcopy(x)
eendebakpt marked this conversation as resolved.
Show resolved Hide resolved

@register_benchmark
def object_cfunction():
accu = 0
Expand Down
Loading
Morty Proxy This is a proxified and sanitized view of the page, visit original site.