-
Notifications
You must be signed in to change notification settings - Fork 247
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
implemented SparseIntSet #533
Conversation
Codecov Report
@@ Coverage Diff @@
## master #533 +/- ##
==========================================
+ Coverage 87.36% 87.81% +0.45%
==========================================
Files 31 32 +1
Lines 1978 2076 +98
==========================================
+ Hits 1728 1823 +95
- Misses 250 253 +3
Continue to review full report at Codecov.
|
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.
Very exciting
Looks pretty good.
I've just done a surface lever review.
I need to take another round at it and look up logic after these changes are in
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 have now finished reviewing the code as it is.
I will review the tests later
Co-Authored-By: Lyndon White <oxinabox@ucc.asn.au>
Okay I think I implemented all your suggestions and made it mutable again. I also made cleaned up |
src/sparse_int_set.jl
Outdated
if pageid > length(s.reverse) | ||
diff = pageid - length(s.reverse) | ||
|
||
resize!(s.reverse, pageid - 1) |
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.
Probably better not to do that? push!
will resize for you.
And it has heuristics to better handle the resizing
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.
Not sure I understand what you mean, do you mean to move assure!
into push!
I guess that's ok since I don't think it's used anywhere else
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.
no, I mean why are we doing resize!
then push!
?
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.
Before this was to generate the undef
s but now indeed i'm just using push!
after sizehint!
, I don't know if that's optimal
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.
it is, basically,
Marginally better is resize!
+ assignment to index
but you missout on the heuristics of how push!
will do extra resizing under the hood when it has to grow (I think sizehint!
actaully might also block those since it iwill grow early)
and that extra reizinging under the hood gives speedup between seperate calls
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.
did a quick benchmark with doing resize!
followed by assignment to index, difference is basically swallowed by noise on the benchmark it seems.
I've been thinking about this a bit. If we make a function We would never get to resize What do you think? |
That sounds reasonable to me, I find the whole |
It should be nothing at all. (baring the single allocation for the global constant |
Co-Authored-By: Lyndon White <oxinabox@ucc.asn.au>
About the iteration through I also ran into a strange inference issue on |
I will look into it in 20 hours time |
I think with the last few comments resolve we will be able to merge this. https://white.ucc.asn.au/2019/09/28/Continuous-Delivery-For-Julia-Packages.html |
src/sparse_int_set.jl
Outdated
return nothing | ||
end | ||
id, tids = id_tids(it, state) | ||
il = length(it) |
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.
If this was done at the start of the function it could also be used in the first if
Also why il
and not something more descriptive, like it_len
or even iterator_length
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, sorry I was too fast in doing this my bad
Co-Authored-By: Lyndon White <oxinabox@ucc.asn.au>
Great! thanks for all your help with this! |
no problem, thanks for your contribution😀 |
I've implemented the SparseIntSet datastructure as was talked about in #532
I based the tests and functionality on that from
IntSet
, but I wasn't sure how to dosymdiff
, and also I'm not sure if it even makes sense in this case.I also added some documentation.
Let me know if there are any things that need to be improved!
Cheers