Skip to content

Commit

Permalink
feat: DependencyProperty read/write benchmark
Browse files Browse the repository at this point in the history
  • Loading branch information
jeromelaban committed Jun 16, 2020
1 parent ff8b869 commit 141aa4d
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
<Compile Include="$(MSBuildThisFileDirectory)Suite\SpanBench\SimpleSpanBenchmark.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Controls\BenchmarkDotNetControl.xaml.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Controls\BenchmarkDotNetTestsPage.xaml.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Suite\Windows_UI_Xaml_Controls\DependencyPropertyBench\SimpleDPBenchmark.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Suite\Windows_UI_Xaml_Controls\UIElementPerf\UIElementCreationBenchmark.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Suite\Windows_UI_Xaml_Controls\GridBench\SimpleGridBenchmark.cs" />
</ItemGroup>
Expand Down
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;
}
}
}
}

0 comments on commit 141aa4d

Please sign in to comment.