-
Notifications
You must be signed in to change notification settings - Fork 2
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
Make faster experimental #1
Conversation
-spec value(orswot()) -> [member()]. | ||
-spec value(orswot() | legacy_orswot()) -> [member()]. | ||
value({_Clock, Entries, _Deferred}) when is_list(Entries) -> | ||
[K || {K, _Dots} <- orddict:to_list(Entries)]; |
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.
isn't Entries already a list?
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.
Entries is now a map().
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.
Yeah, but in this case you are already checking is_list(Entries) then why orddict:to_list?
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.
Because, orddict is an opaque type (even though we know it's implemented as a list).
Deffered = merge_deferred(LHSDeferred, RHSDeferred), | ||
apply_deferred(Clock, Entries, Deffered); | ||
merge(?EMPTY_ORSWOT, RHS) -> RHS; | ||
merge(LHS, ?EMPTY_ORSWOT) -> LHS; |
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.
Should we move EMPTY_ORSWOT pattern match above Deferred checks?
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.
We should try to merge deferred if we can.
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.
You want to do that only if it is non-empty. For Empty ones there is no merge, right?
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.
ah, right. I'll move it.
|
||
-spec remove_elem({ok, riak_dt_vclock:vclock()} | error, | ||
member(), {riak_dt_vclock:vclock(), orddict:orddict(), deferred()}) -> | ||
member(), orswot()) -> | ||
{ok, {riak_dt_vclock:vclock(), orddict:orddict(), deferred()}} | |
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.
orddict --> map in return typespec?
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.
eh? Confused?
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.
return typespec {ok, {riak_dt_vclock:vclock(), orddict:orddict(), deferred()}} -> {ok, {riak_dt_vclock:vclock(), map(), deferred()}}.
equal({Clock1, Entries1, _}, {Clock2, Entries2, _}) -> | ||
riak_dt_vclock:equal(Clock1, Clock2) andalso | ||
orddict:fetch_keys(Entries1) == orddict:fetch_keys(Entries2) andalso | ||
Entries1 == Entries2 andalso |
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.
maybe move Entries1 == Entries2 check as the first one?
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.
Comparing the vclocks is faster because that's implemented in C :).
Pushed your changes. |
lgtm |
No description provided.