Movatterモバイル変換


[0]ホーム

URL:


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

Sign up
Appearance settings

gh-75572: Speed up test_xpickle#144393

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged

Conversation

@serhiy-storchaka
Copy link
Member

@serhiy-storchakaserhiy-storchaka commentedFeb 2, 2026
edited by bedevere-appbot
Loading

Run a long living subprocess which handles multiple requests instead of running a new subprocess for each request.

Run a long living subprocess which handles multiple requests instead ofrunning a new subprocess for each request.
@serhiy-storchakaserhiy-storchaka added testsTests in the Lib/test dir skip news needs backport to 3.13bugs and security fixes needs backport to 3.14bugs and security fixes labelsFeb 2, 2026
worker =cls.worker
ifworkeris None:
target = os.path.join(os.path.dirname(__file__), 'xpickle_worker.py')
worker =subprocess.Popen([*python, target],
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Why not calling start_worker() here?

Copy link
MemberAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Oh, this is a remnant. I was not sure whether it is worth to move this code out into a method.

cls.worker = worker

@classmethod
def close_worker(cls):
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

"stop_worker()" name would be better to have start/stop_worker methods.

stdout=subprocess.PIPE,
stderr=subprocess.PIPE,
# For windows bpo-17023.
shell=is_windows)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

You should usetext=True to fix this code below:

_,stderr=worker.communicate()raiseRuntimeError(stderr)

Copy link
MemberAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

But we do binary IO for stdin/stdout in normal case.

This code is only for troubleshooting. It is not executed when the tests pass.

Copy link
Member

@vstinnervstinner left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

./python -m test test_xpickle -u xpickle,cpu -v command takes:

  • main branch:24 min 38 sec
  • this PR:1 min 24 sec

Well, it's much faster with this PR :-)

Note: I measured timings on a debug build (gcc -Og).

Copy link
Member

@vstinnervstinner left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

LGTM.

@serhiy-storchaka
Copy link
MemberAuthor

Note that you can run it only for the selected version, e.g.xpython=3.13. In debug build it is about 50% slower.

@serhiy-storchakaserhiy-storchaka merged commit29acc08 intopython:mainFeb 2, 2026
49 checks passed
@miss-islington-app
Copy link

Thanks@serhiy-storchaka for the PR 🌮🎉.. I'm working now to backport this PR to: 3.13, 3.14.
🐍🍒⛏🤖 I'm not a witch! I'm not a witch!

miss-islington pushed a commit to miss-islington/cpython that referenced this pull requestFeb 2, 2026
Run a long living subprocess which handles multiple requests instead ofrunning a new subprocess for each request.(cherry picked from commit 29acc08c8dad664cd5713cb392e5beba65724c10)Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
miss-islington pushed a commit to miss-islington/cpython that referenced this pull requestFeb 2, 2026
Run a long living subprocess which handles multiple requests instead ofrunning a new subprocess for each request.(cherry picked from commit29acc08)Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
@bedevere-app
Copy link

GH-144403 is a backport of this pull request to the3.14 branch.

@bedevere-appbedevere-appbot removed the needs backport to 3.14bugs and security fixes labelFeb 2, 2026
@serhiy-storchakaserhiy-storchaka deleted the test_xpickle-speedup branchFebruary 2, 2026 18:00
@bedevere-app
Copy link

GH-144404 is a backport of this pull request to the3.13 branch.

@bedevere-appbedevere-appbot removed the needs backport to 3.13bugs and security fixes labelFeb 2, 2026
serhiy-storchaka added a commit that referenced this pull requestFeb 3, 2026
Run a long living subprocess which handles multiple requests instead ofrunning a new subprocess for each request.(cherry picked from commit29acc08)Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
serhiy-storchaka added a commit that referenced this pull requestFeb 3, 2026
Run a long living subprocess which handles multiple requests instead ofrunning a new subprocess for each request.(cherry picked from commit29acc08)Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
@bedevere-bot
Copy link

⚠️⚠️⚠️ Buildbot failure⚠️⚠️⚠️

Hi! The buildbotAMD64 Windows Server 2022 NoGIL 3.13 (tier-1) has failed when building commit9d76689.

What do you need to do:

  1. Don't panic.
  2. Checkthe buildbot page in the devguide if you don't know what the buildbots are or how they work.
  3. Go to the page of the buildbot that failed (https://buildbot.python.org/#/builders/1488/builds/1904) and take a look at the build logs.
  4. Check if the failure is related to this commit (9d76689) or if it is a false positive.
  5. If the failure is related to this commit, please, reflect that on the issue and make a new Pull Request with a fix.

You can take a look at the buildbot page here:

https://buildbot.python.org/#/builders/1488/builds/1904

Failed tests:

  • test_launcher

Failed subtests:

  • test_search_major_2 - test.test_launcher.TestLauncher.test_search_major_2
  • test_search_major_3 - test.test_launcher.TestLauncher.test_search_major_3

Summary of the results of the build (if available):

==

Click to see traceback logs
Traceback (most recent call last):  File"C:\Users\Administrator\buildarea\3.13.itamaro-win64-srv-22-aws.x64.nogil\build\Lib\test\test_launcher.py", line445, intest_search_major_3self.assertEqual("PythonCore", data["env.company"])~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^AssertionError:'PythonCore' != 'PythonTestSuite'- PythonCore+ PythonTestSuiteTraceback (most recent call last):  File"C:\Users\Administrator\buildarea\3.13.itamaro-win64-srv-22-aws.x64.nogil\build\Lib\test\test_launcher.py", line465, intest_search_major_2self.assertEqual("PythonCore", data["env.company"])~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^AssertionError:'PythonCore' != 'PythonTestSuite'- PythonCore+ PythonTestSuite

@bedevere-bot
Copy link

⚠️⚠️⚠️ Buildbot failure⚠️⚠️⚠️

Hi! The buildbotAMD64 Debian root 3.13 (tier-1) has failed when building commit9d76689.

What do you need to do:

  1. Don't panic.
  2. Checkthe buildbot page in the devguide if you don't know what the buildbots are or how they work.
  3. Go to the page of the buildbot that failed (https://buildbot.python.org/#/builders/1441/builds/1761) and take a look at the build logs.
  4. Check if the failure is related to this commit (9d76689) or if it is a false positive.
  5. If the failure is related to this commit, please, reflect that on the issue and make a new Pull Request with a fix.

You can take a look at the buildbot page here:

https://buildbot.python.org/#/builders/1441/builds/1761

Summary of the results of the build (if available):

==

Click to see traceback logs
Traceback (most recent call last):  File"/root/buildarea/3.13.angelico-debian-amd64/build/Lib/test/support/__init__.py", line856, ingc_collect    gc.collect()ResourceWarning:unclosed file <_io.FileIO name=13 mode='wb' closefd=True>

Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

@vstinnervstinnervstinner approved these changes

Assignees

No one assigned

Labels

skip newstestsTests in the Lib/test dir

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

3 participants

@serhiy-storchaka@bedevere-bot@vstinner

[8]ページ先頭

©2009-2026 Movatter.jp