Skip to content

Commit

Permalink
gh-35265: Improve approximate order on getitem calls
Browse files Browse the repository at this point in the history
    
<!-- ^^^^^
Please provide a concise, informative and self-explanatory title.
Don't put issue numbers in there, do this in the PR body below.
For example, instead of "Fixes #1234" use "Introduce new method to
calculate 1+1"
-->
### 📚 Description

Calling `Stream_inexact.__getitem__(n)` for `n ==
self._approximate_order`, we can update `self._true_order` and
`self._approximate_order` as follows:

* if the result is non-zero, we now know that `n` is the true order
* otherwise, we know that `n+1` is a lower bound for the order.
<!-- Describe your changes here in detail -->
<!-- Why is this change required? What problem does it solve? -->
<!-- If it resolves an open issue, please link to the issue here. For
example "Closes #1337" -->

This fixes #35261, but it may not be the best fix, because it
potentially makes `__getitem__` slower.

Fixes #34556, which was the original issue.

### 📝 Checklist

<!-- Put an `x` in all the boxes that apply. -->
<!-- If your change requires a documentation PR, please link it
appropriately -->
<!-- If you're unsure about any of these, don't hesitate to ask. We're
here to help! -->

- [x] I have made sure that the title is self-explanatory and the
description concisely explains the PR.
- [x] I have linked an issue or discussion.
- [x] I have created tests covering the changes.
- [x] I have updated the documentation accordingly.

### ⌛ Dependencies
<!-- List all open pull requests that this PR logically depends on -->
<!--
- #xyz: short description why this is a dependency
- #abc: ...
-->
    
URL: #35265
Reported by: Martin Rubey
Reviewer(s): Martin Rubey, Travis Scrimshaw
  • Loading branch information
Release Manager committed Mar 31, 2023
2 parents 45e98cb + 4fc560b commit 3142be9
Show file tree
Hide file tree
Showing 3 changed files with 176 additions and 143 deletions.

0 comments on commit 3142be9

Please sign in to comment.