Skip to content
This repository was archived by the owner on Dec 5, 2024. It is now read-only.

Commit 7a5c16d

Browse files
NPath optimization when looking for the search label
Method | Mean | Error | StdDev | ----------------------------- |---------:|---------:|---------:| OriginalTreeBuilderBenchmark | 65.67 ms | 1.296 ms | 1.730 ms | CurrentTreeBuilderBenchmark | 55.80 ms | 1.102 ms | 1.683 ms |
1 parent 15388c1 commit 7a5c16d

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/GitHub.Api/UI/TreeBuilder.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,10 +49,11 @@ internal static void BuildChildNode(FileTreeNode parent, FileTreeNode node, List
4949
{
5050
// Look for a branch matching our root in the existing children
5151
var found = false;
52+
var searchLabel = nodePath.Parent.Combine(nodePath.FileNameWithoutExtension);
5253
foreach (var child in parent.Children)
5354
{
5455
// If we found the branch, continue building from that branch
55-
if (child.Label.Equals(nodePath.Parent.Combine(nodePath.FileNameWithoutExtension)))
56+
if (child.Label.Equals(searchLabel))
5657
{
5758
found = true;
5859
BuildChildNode(child, node, foldedTreeEntries1, stateChangeCallback1);

0 commit comments

Comments
 (0)