-
-
Notifications
You must be signed in to change notification settings - Fork 11.1k
MAINT: Remove internal uses of _inspect module #16787
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
Closed
Closed
Changes from 1 commit
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
b3bc0fb
MAINT: rm _inspect from numpy/core/overrides.
rossbar 82f94cd
MAINT: rm _inspect from numpy/ma/core.
rossbar 0f84e10
MAINT: modify impl of verify_matching_signatures.
rossbar 31e8068
Fixups from code review.
rossbar c1eeb82
Incorporate more comments from review.
rossbar 6e35c2a
Apply suggestions from code review
rossbar File filter
Filter by extension
Conversations
Failed to load comments.
8000
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Incorporate more comments from review.
- Loading branch information
commit c1eeb824f7d927d53abf6aef72f93c05d414e2d2
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I can only assume the timings are bad because
inspect.signature
is slower thangetargspec
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, some (very rough) profiling indicates that this is the case. Using the following setup:
timeit
gives:On 6e35c2a (this PR):
On 2283e26 (root of branch):
So the implementation based on
inspect.signature
is about 15x slower than the original based on_inspect.getargspec
.One idea I had was to try to re-implement this with
inspect.getfullargspec
, which is the more full-featured extension of the original (now deprecated)inspect.getargspec
. I will update with-X importtime
& profiling info from the attempt.Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is implemented in terms of
inspect.signature
, then does some extra processing. You'd do better to probe the__code__
object directly.Perhaps the comparison is the slow part.