-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
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
Ensure that BitArrays are inferrable for arbitrary Integer
#37082
Conversation
599efe0
to
46cba9b
Compare
BitArray operations are frequently performed with partial inference information (particularly from Pkg but others as well). Currently the internal operations are a source of invalidation for common arithmetic and bitwise operators. There seems to be no need to live with this, as all the inference problems are fixed by converting `Integer`s to `Int`s. This is done elsewhere already in BitArray code, so it only seems to be continuing a process that is already underway. Because of the multiplicity of methods `BitArray{N}(a::Any)` is not fully inferrable but there are at least limited victories, and the real benefits are in the elimination of instabilities in the internal operations.
46cba9b
to
83877fc
Compare
83877fc
to
b9a8b30
Compare
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.
There are a few more functions that could split out the Int
conversion but maybe they are considered small so it doesn't really matter.
@@ -933,6 +947,7 @@ function _deleteat!(B::BitVector, i::Integer) | |||
end | |||
|
|||
function deleteat!(B::BitVector, i::Integer) | |||
i = Int(i) |
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.
Could do the "split out the Int
conversion part"-dance here as well.
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.
My feeling is the bit of bounds-checking isn't worth worrying about.
…ng#37082) BitArray operations are frequently performed with partial inference information (particularly from Pkg but others as well). Currently the internal operations are a source of invalidation for common arithmetic and bitwise operators. There seems to be no need to live with this, as all the inference problems are fixed by converting `Integer`s to `Int`s. This is done elsewhere already in BitArray code, so it only seems to be continuing a process that is already underway. Because of the multiplicity of methods `BitArray{N}(a::Any)` is not fully inferrable but there are at least limited victories, and the real benefits are in the elimination of instabilities in the internal operations.
BitArray operations are frequently performed with partial inference information (particularly from Pkg but others as well). Currently the internal operations are a source of invalidation for common arithmetic and bitwise operators. There seems to be no need to live with this, as all the inference problems are fixed by converting
Integer
s toInt
s. This is done elsewhere already in BitArray code, so it only seems to be continuing a process that is already underway.Because of the multiplicity of methods
BitArray{N}(a::Any)
is not fully inferrable but there are at least limited victories, and the real benefits are in the elimination of instabilities in the internal operations.