Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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
Replace function exceptwith and unionwith with faster functions #1174
Replace function exceptwith and unionwith with faster functions #1174
Changes from 26 commits
36c1d16
b7f9c02
318c99f
0d6b842
af23059
82930da
54d2af8
a745880
e0f9145
a84eff9
dd36f20
089b935
a571c22
4381b4c
dd4a435
95136ed
edc0333
4ddc299
6da2fc2
bcf1c62
88753a6
59ee120
921a343
621c4e3
051b7c1
96418c4
f325f96
b1f5914
f1cef96
2e704e6
12aa262
9b71d5f
b23244f
360f20a
ec2bfd7
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
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.
Why change this class?
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.
Is faster than the
OrderedDictionary
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.
Is this a linked 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.
Yes
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.
Then the performance of
Contains()
is low. This is very important. Otherwise we can useSystem.Collections.Generic.LinkedList<T>
directly.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.
Have you tested occasions when the FIFOSet be very large? In this occasion, when knownHashes trys to add payload hashes into itself, it will firstly check whether the specified hash already exists. So if knowhashes is very large and transactions keep pouring in, time consumed by this line can be rather long.
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.
This check was done in the previous version also
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.
neo/neo/IO/Caching/FIFOSet.cs
Line 27 in cd85039
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.
But I think in previous version the computation complexity of func contains is O(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.
Agree with @Qiao-Jin. I can't imagine that linked lists will be faster than hash tables.