Skip to content

Conversation

user202729
Copy link
Contributor

@user202729 user202729 commented Aug 30, 2025

Follow-up to #40556. Now the sig_occurred() check in fast_tp_dealloc is removed.


This is the effect on the last commit, changing divisors() to use sig_check().

Before:

sage: n = prod(primes_first_n(17))
....: %timeit ignore = n.divisors()
20 ms ± 245 μs per loop (mean ± std. dev. of 7 runs, 10 loops each)
sage: n = prod(primes_first_n(17))
....: %timeit ignore = n.divisors()
20.5 ms ± 616 μs per loop (mean ± std. dev. of 7 runs, 10 loops each)
sage: n = prod(primes_first_n(17))
....: %timeit ignore = n.divisors()
20 ms ± 302 μs per loop (mean ± std. dev. of 7 runs, 10 loops each)

After:

sage: n = prod(primes_first_n(17))
....: %timeit ignore = n.divisors()
20.6 ms ± 424 μs per loop (mean ± std. dev. of 7 runs, 10 loops each)
sage: n = prod(primes_first_n(17))
....: %timeit ignore = n.divisors()
20.5 ms ± 254 μs per loop (mean ± std. dev. of 7 runs, 10 loops each)
sage: n = prod(primes_first_n(17))
....: %timeit ignore = n.divisors()
20.7 ms ± 206 μs per loop (mean ± std. dev. of 7 runs, 10 loops each)

📝 Checklist

  • The title is concise and informative.
  • The description explains in detail what this PR is about.
  • I have linked a relevant issue or discussion.
  • I have created tests covering the changes.
  • I have updated the documentation and checked the documentation preview.

⌛ Dependencies

@user202729 user202729 changed the title Avoid mutate Integer.value at a few more places Avoid mutate Integer.value at a few more places, remove sig_occurred() check in Integer fast_tp_dealloc Aug 30, 2025
Copy link

github-actions bot commented Aug 30, 2025

Documentation preview for this PR (built with commit 49c41d4; changes) is ready! 🎉
This preview will update shortly after each push to this PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant