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

Reduce runtime of slow test #4946

Merged
merged 1 commit into from
Feb 27, 2025
Merged

Reduce runtime of slow test #4946

merged 1 commit into from
Feb 27, 2025

Conversation

ngoldbaum
Copy link
Contributor

On my main development machine - an M3 Macbook Pro - this test currently takes ~2 seconds, introducing a noticeable pause running cargo test --lib:

cargo test --lib "types::mappingproxy::tests::iter_mappingproxy_nosegv" -- -Zunstable-options --report-time
   Compiling pyo3 v0.23.5 (/Users/goldbaum/Documents/pyo3)
    Finished `test` profile [unoptimized + debuginfo] target(s) in 2.39s
     Running unittests src/lib.rs (target/debug/deps/pyo3-246e609de32070b5)

running 1 test
test types::mappingproxy::tests::iter_mappingproxy_nosegv ... ok <2.079s>

test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 717 filtered out; finished in 2.08s

After this PR, it drops down to 35 milliseconds:

running 1 test
test types::mappingproxy::tests::iter_mappingproxy_nosegv ... ok <0.035s>

test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 717 filtered out; finished in 0.04s

The slowdown is much worse when I'm testing some thread safety-related changes under TSAN.

I don't think there's any particular reason this loop needs so many iterations but please let me know if you chose the parameters for this test for a reason I'm missing @KLMatlock!

@ngoldbaum ngoldbaum added the CI-skip-changelog Skip checking changelog entry label Feb 27, 2025
Copy link
Member

@davidhewitt davidhewitt left a comment

Choose a reason for hiding this comment

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

Yep I think this is fine to simplify. I think these tests originate from a long long time ago (maybe 2 prior iterations of PyO3's main object API or more) and were present to monitor for bugs related to getting borrowed reference counting wrong!

@ngoldbaum ngoldbaum added this pull request to the merge queue Feb 27, 2025
Merged via the queue into PyO3:main with commit 1ced0a3 Feb 27, 2025
48 of 49 checks passed
@ngoldbaum ngoldbaum deleted the slow-test branch February 27, 2025 23:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CI-skip-changelog Skip checking changelog entry
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants