-
Notifications
You must be signed in to change notification settings - Fork 94
Improve indexing performance #1129
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
Changes from all commits
c246e25
5df4170
af6ebcb
df59fc5
9ceded6
19612b6
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -22,15 +22,16 @@ end | |
|
||
# Implementation of the `AbstractDict` API. | ||
# Base.empty(::DenseDict, ::Type{K}, ::Type{V}) not implemented | ||
function Base.iterate(d::DenseDict, args...) | ||
function Base.iterate(d::DenseDict{K,V}, args...) where {K,V} | ||
itr = iterate(d.set, args...) | ||
if itr === nothing | ||
return nothing | ||
else | ||
el, i = itr | ||
return d.inverse_hash(el) => d.map[el], i | ||
return d.inverse_hash(el)::K => d.map[el]::V, i | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Are the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Just tested, Julia does not seem to infer those correctly. Therefore the is a very minor difference a little less than 1%. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. No if Julia inference is not doing it correctly then leaving it there is what we should do |
||
end | ||
end | ||
|
||
Base.length(d::DenseDict) = length(d.set) | ||
Base.haskey(dict::DenseDict, key) = dict.hash(key) in dict.set | ||
Base.getindex(dict::DenseDict, key) = dict.map[dict.hash(key)] | ||
|
Uh oh!
There was an error while loading. Please reload this page.