-
-
Notifications
You must be signed in to change notification settings - Fork 18.4k
PERF: statically define classes for is_dtype checks #33364
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
Conversation
issubclass(tipo, klasses) | ||
and not issubclass(tipo, (np.datetime64, np.timedelta64)) | ||
) | ||
_object_classes = lambda tipo: issubclass(tipo, np.object_) |
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.
better as a dict i would think
in fact could simply instantiate classes |
Nice, I didnt expect |
Hmm don't think that issue is the root of any ASV issues - are you getting any other error messages from the run? Maybe worth opening a dedicated issue |
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 would move the logic into the is_* functions themselves
Which logic would you move? It seems like |
@@ -457,7 +465,7 @@ def is_timedelta64_dtype(arr_or_dtype) -> bool: | |||
>>> is_timedelta64_dtype('0 days') | |||
False | |||
""" | |||
return _is_dtype_type(arr_or_dtype, classes(np.timedelta64)) | |||
return _is_dtype_type(arr_or_dtype, _timedelta64_classes) |
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.
example instead of creating the module level variable I would simply hardcode:
lambda tipo: issubclass(tipo, np.timedelta64)
right here. its much more obvious.
@TomAugspurger is this still something you want to merge, or is it superceded by #33400? |
Probably a non-issue (or less pressing) after #33400 is done. I'll re-run
benchmarks after that's merged.
…On Thu, Apr 16, 2020 at 12:23 PM jbrockmendel ***@***.***> wrote:
@TomAugspurger <https://github.com/TomAugspurger> is this still something
you want to merge, or is it superceded by #33400
<#33400>?
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#33364 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAKAOISFT56BCX3OG7EYTJ3RM45J5ANCNFSM4MDBB6BQ>
.
|
needs rebase |
ok with this if we can update to comments. |
conceptually ok with this if you can update to comments |
closing as stale |
This moves the definition of the functions passed to
_is_dtype_type
from dynamically generated functions isis_integer_dtype
to top-level functions. I can't run asv right now (#33315 (comment)) but here are some timeitsmaster
This PR