Conversation
Contributor
Contributor
|
Using the same test code as which is used in #1382 . Faster than original Below attaches the test code: [TestMethod]
public void TestFIFOSet()
{
Stopwatch stopwatch = new Stopwatch();
var bucket = new FIFOSet<int>(150_000);
stopwatch.Start();
for (int i = 1; i <= 550_000; i++)
{
bucket.Add(i);
}
stopwatch.Stop();
Console.WriteLine($"Add timespan: {stopwatch.Elapsed.TotalSeconds}s");
stopwatch.Reset();
var items = new int[10000];
var value = 550_000;
for (int i = 0; i <= 9999; i++)
{
items[i] = value;
value -= 50;
}
stopwatch.Start();
bucket.ExceptWith(items);
stopwatch.Stop();
Console.WriteLine($"except with timespan: {stopwatch.Elapsed.TotalSeconds}s");
stopwatch.Reset();
stopwatch.Start();
var ret = bucket.Contains(140_000);
stopwatch.Stop();
Console.WriteLine($"contains with timespan: {stopwatch.Elapsed.TotalSeconds}s result: {ret}");
stopwatch.Reset();
stopwatch.Start();
ret = bucket.Contains(545_001);
stopwatch.Stop();
Console.WriteLine($"contains with timespan: {stopwatch.Elapsed.TotalSeconds}s result: {ret}");
stopwatch.Reset();
} |
Member
|
@eryeer, @erikzhang, looking at the results here: #1389 (comment) I believe it will be better to move to the "HashSet", a little more complex (almost as in the original, but considerably faster). Nice job, @eryeer, as always. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Closes #1382, closes #1389
@eryeer Can you test this?