-
Notifications
You must be signed in to change notification settings - Fork 730
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: DependencyProperty read/write benchmark
- Loading branch information
1 parent
ff8b869
commit 141aa4d
Showing
2 changed files
with
39 additions
and
0 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
38 changes: 38 additions & 0 deletions
38
...hmarks.Shared/Suite/Windows_UI_Xaml_Controls/DependencyPropertyBench/SimpleDPBenchmark.cs
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,38 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Text; | ||
using BenchmarkDotNet.Attributes; | ||
using Windows.Foundation; | ||
using Windows.UI.Xaml.Controls; | ||
|
||
namespace SamplesApp.Benchmarks.Suite.Windows_UI_Xaml_Controls.GridBench | ||
{ | ||
public class SimpleDPBenchmark | ||
{ | ||
private Grid SUT; | ||
|
||
[GlobalSetup] | ||
public void Setup() | ||
{ | ||
SUT = new Grid(); | ||
} | ||
|
||
[Benchmark()] | ||
public void DP_Write() | ||
{ | ||
for (int i = 0; i < 100; i++) | ||
{ | ||
SUT.Width = i; | ||
} | ||
} | ||
|
||
[Benchmark()] | ||
public void DP_Read() | ||
{ | ||
for (int i = 0; i < 100; i++) | ||
{ | ||
var r = SUT.Width; | ||
} | ||
} | ||
} | ||
} |