Skip to content
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

gh-124402: Speed up test_free_threading and test_super #124491

Merged
merged 1 commit into from
Sep 26, 2024

Conversation

vstinner
Copy link
Member

@vstinner vstinner commented Sep 25, 2024

  • Reduce the number of iterations and the number of threads so a whole test file takes less than a minute.
  • Refactor test_racing_iter_extend() to remove two levels of indentation.
  • test_monitoring() uses a sleep of 100 ms instead of 1 second.

* Reduce the number of iterations and the number of threads so a
  whole test file takes less than a minute.
* Refactor test_racing_iter_extend() to remove two levels of
  indentation.
* test_monitoring() uses a sleep of 100 ms instead of 1 second.
@vstinner
Copy link
Member Author

@colesbury: Here is a PR to always run tests, but reduce their time budget to stick into 1 minute per test file.

How can I check if the modified tests are still useful?

@vstinner
Copy link
Member Author

Linux:

  • test_free_threading takes 12.9 sec
  • test_super takes 1.9 sec

Windows:

  • test_free_threading takes 50.0 sec
  • test_super takes 16.2 sec

@corona10 corona10 requested a review from colesbury September 25, 2024 08:17
Copy link
Contributor

@colesbury colesbury left a comment

Choose a reason for hiding this comment

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

These LGTM.

I tested a few of these by looking at the PR that added the test and undoing the thread safety changes.

@vstinner vstinner marked this pull request as ready for review September 26, 2024 08:51
@vstinner vstinner merged commit 0387c34 into python:main Sep 26, 2024
38 checks passed
@miss-islington-app
Copy link

Thanks @vstinner for the PR 🌮🎉.. I'm working now to backport this PR to: 3.13.
🐍🍒⛏🤖

@vstinner vstinner deleted the test_free_threading branch September 26, 2024 08:53
@miss-islington-app
Copy link

Sorry, @vstinner, I could not cleanly backport this to 3.13 due to a conflict.
Please backport using cherry_picker on command line.

cherry_picker 0387c34f7c91428681ca8a4ba4e3d22b9acffde4 3.13

@vstinner
Copy link
Member Author

@colesbury:

These LGTM. I tested a few of these by looking at the PR that added the test and undoing the thread safety changes.

Oh ok, thanks for testing! I merged my PR.

vstinner added a commit to vstinner/cpython that referenced this pull request Sep 26, 2024
…124491)

* Reduce the number of iterations and the number of threads so a
  whole test file takes less than a minute.
* Refactor test_racing_iter_extend() to remove two levels of
  indentation.
* test_monitoring() uses a sleep of 100 ms instead of 1 second.

(cherry picked from commit 0387c34)
@bedevere-app
Copy link

bedevere-app bot commented Sep 26, 2024

GH-124585 is a backport of this pull request to the 3.13 branch.

@bedevere-app bedevere-app bot removed the needs backport to 3.13 bugs and security fixes label Sep 26, 2024
Yhg1s pushed a commit that referenced this pull request Sep 26, 2024
… (#124585)

gh-124402: Speed up test_free_threading and test_super (#124491)

* Reduce the number of iterations and the number of threads so a
  whole test file takes less than a minute.
* Refactor test_racing_iter_extend() to remove two levels of
  indentation.
* test_monitoring() uses a sleep of 100 ms instead of 1 second.

(cherry picked from commit 0387c34)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
skip news tests Tests in the Lib/test dir
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants