-
Notifications
You must be signed in to change notification settings - Fork 4k
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
Switch to a simpler algorithm for placing hte interval tree array elements. #73868
Conversation
@@ -416,4 +416,31 @@ public void TestProperBalancing() | |||
AssertEx.Equal(tree, Enumerable.Range(1, i)); | |||
} | |||
} | |||
|
|||
[Fact] | |||
public void TestVeryLargeBalancing() |
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 wnated tests that also validated the edge cases in large trees to ensure the math was scaling up properly.
{ | ||
for (var i = 10; i < 20; i++) | ||
{ | ||
var totalCount = 1 << i; |
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.
trees up to 1m elements in size.
...Workspaces/SharedUtilitiesAndExtensions/Compiler/Core/Collections/FlatArrayIntervalTree`1.cs
Outdated
Show resolved
Hide resolved
...Workspaces/SharedUtilitiesAndExtensions/Compiler/Core/Collections/FlatArrayIntervalTree`1.cs
Outdated
Show resolved
Hide resolved
...Workspaces/SharedUtilitiesAndExtensions/Compiler/Core/Collections/FlatArrayIntervalTree`1.cs
Outdated
Show resolved
Hide resolved
…ections/FlatArrayIntervalTree`1.cs
...Workspaces/SharedUtilitiesAndExtensions/Compiler/Core/Collections/FlatArrayIntervalTree`1.cs
Outdated
Show resolved
Hide resolved
…ections/FlatArrayIntervalTree`1.cs
BuildCompleteTreeRecursive(source, destination, midPoint + 1, endExclusive, GetRightChildIndex(destinationIndex)); | ||
// The total tree height. If we're perfect, it's the height of the perfect portion. Otherwise | ||
// it's one higher (to fit the remaining incomplete row). | ||
var treeHeight = isPerfect ? perfectPortionHeight : perfectPortionHeight + 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.
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.
will do in followup.
|
||
// Here we can figure out which case we have, and where the pivot it. First, we start with | ||
// | ||
// 1. `a = subtreeNodeCount - perfectSectionNodeCount`. The number of elements in the 'incomplete' last row. |
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.
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.
will do in followup.
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 description provided.