Skip to content

Commit

Permalink
Added performance test for converting images
Browse files Browse the repository at this point in the history
  • Loading branch information
ssnenov committed Oct 30, 2016
1 parent 77dcfd6 commit 14871d3
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 0 deletions.
1 change: 1 addition & 0 deletions Html2Amp.PerfTests/Html2Amp.PerfTests.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@
</ItemGroup>
<ItemGroup>
<Compile Include="ElementExtensionsTests\ElementExtensions_CopyTo.cs" />
<Compile Include="Html2AmpConverting\ConvertingImageElement.cs" />
<Compile Include="Program.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
Expand Down
20 changes: 20 additions & 0 deletions Html2Amp.PerfTests/Html2AmpConverting/ConvertingImageElement.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
using BenchmarkDotNet.Attributes;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Html2Amp.PerfTests
{
public class HtmlConverting
{
private static HtmlToAmpConverter htmlToAmpConverter = new HtmlToAmpConverter();

[Benchmark]
public ConvertionResult ConvertSimpleImageElementToAmp()
{
return htmlToAmpConverter.ConvertFromHtml("<img src=\"test-image.png\" width=\"100\" height=\"100\" />");
}
}
}
1 change: 1 addition & 0 deletions Html2Amp.PerfTests/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ public class Program
public static void Main(string[] args)
{
BenchmarkRunner.Run<ElementExtensions_CopyTo>();
BenchmarkRunner.Run<HtmlConverting>();
}
}
}

0 comments on commit 14871d3

Please sign in to comment.