-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Improves performance of GetLayoutHandlerIndex (#18499)
- Loading branch information
1 parent
86b8757
commit 98924fa
Showing
4 changed files
with
89 additions
and
2 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
using BenchmarkDotNet.Attributes; | ||
using Microsoft.Maui.Controls; | ||
using Microsoft.Maui.Handlers; | ||
|
||
namespace Microsoft.Maui.Benchmarks | ||
{ | ||
[MemoryDiagnoser] | ||
public class LayoutBenchmarker | ||
{ | ||
static readonly Border[] Views = new[] | ||
{ | ||
new Border(), new Border(), new Border(), new Border(), new Border(), new Border(), new Border(), | ||
new Border(), new Border(), new Border(), new Border(), new Border(), new Border(), new Border() | ||
}; | ||
|
||
static readonly int Iterations = Views.Length; | ||
|
||
[Benchmark] | ||
public void GetLayoutHandlerIndex() | ||
{ | ||
var layout = new VerticalStackLayout(); | ||
|
||
for (int i = 0; i < Iterations; i++) | ||
{ | ||
var view = Views[i]; | ||
layout.Add(view); | ||
layout.GetLayoutHandlerIndex(view); | ||
} | ||
} | ||
} | ||
} |
This file contains 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