Skip to content
Permalink
Browse files

Initial benchmark for basic site

  • Loading branch information...
Turnerj committed Jan 1, 2019
1 parent 325f7ae commit bbd7d488a5a2b55aa9ef9c6ff14d0e0c0fc5dc19
@@ -21,9 +21,11 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "tests", "tests", "{46BF0980
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "InfinityCrawler", "src\InfinityCrawler\InfinityCrawler.csproj", "{90361E0D-CB4C-4BCC-AAF2-70DAF87D5565}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "InfinityCrawler.Tests", "tests\InfinityCrawler.Tests\InfinityCrawler.Tests.csproj", "{F30AF2A4-C53F-40FE-8083-6A82C0583255}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "InfinityCrawler.Tests", "tests\InfinityCrawler.Tests\InfinityCrawler.Tests.csproj", "{F30AF2A4-C53F-40FE-8083-6A82C0583255}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "InfinityCrawler.Tests.TestSite", "tests\InfinityCrawler.Tests.TestSite\InfinityCrawler.Tests.TestSite.csproj", "{483B6FC9-98E7-4BD4-BA09-80DF504E31B2}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "InfinityCrawler.Tests.TestSite", "tests\InfinityCrawler.Tests.TestSite\InfinityCrawler.Tests.TestSite.csproj", "{483B6FC9-98E7-4BD4-BA09-80DF504E31B2}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "InfinityCrawler.Tests.Benchmarks", "tests\InfinityCrawler.Tests.Benchmarks\InfinityCrawler.Tests.Benchmarks.csproj", "{F17C5CAC-DF32-434B-A4C5-21CBDDA86B97}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
@@ -43,6 +45,10 @@ Global
{483B6FC9-98E7-4BD4-BA09-80DF504E31B2}.Debug|Any CPU.Build.0 = Debug|Any CPU
{483B6FC9-98E7-4BD4-BA09-80DF504E31B2}.Release|Any CPU.ActiveCfg = Release|Any CPU
{483B6FC9-98E7-4BD4-BA09-80DF504E31B2}.Release|Any CPU.Build.0 = Release|Any CPU
{F17C5CAC-DF32-434B-A4C5-21CBDDA86B97}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{F17C5CAC-DF32-434B-A4C5-21CBDDA86B97}.Debug|Any CPU.Build.0 = Debug|Any CPU
{F17C5CAC-DF32-434B-A4C5-21CBDDA86B97}.Release|Any CPU.ActiveCfg = Release|Any CPU
{F17C5CAC-DF32-434B-A4C5-21CBDDA86B97}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
@@ -51,6 +57,7 @@ Global
{90361E0D-CB4C-4BCC-AAF2-70DAF87D5565} = {C6187826-9F4B-4E85-90D1-BC46A0F7F8F1}
{F30AF2A4-C53F-40FE-8083-6A82C0583255} = {46BF0980-A8A4-492E-8652-0725ADB6A683}
{483B6FC9-98E7-4BD4-BA09-80DF504E31B2} = {46BF0980-A8A4-492E-8652-0725ADB6A683}
{F17C5CAC-DF32-434B-A4C5-21CBDDA86B97} = {46BF0980-A8A4-492E-8652-0725ADB6A683}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {FC9AB8BE-670B-4F26-9F17-73D2C0DECA6A}
@@ -0,0 +1,46 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using BenchmarkDotNet.Attributes;
using InfinityCrawler.TaskHandlers;
using InfinityCrawler.Tests.TestSite;

namespace InfinityCrawler.Tests.Benchmarks
{
[CoreJob, ClrJob(baseline: true)]
[MemoryDiagnoser]
public class BasicSiteCrawlBenchmark
{
private TestSiteManager TestSite { get; }
private Crawler Crawler { get; }
private Uri Uri { get; } = new Uri("http://localhost/");

public BasicSiteCrawlBenchmark()
{
TestSite = new TestSiteManager(new SiteContext
{
SiteFolder = "BasicSite"
});

var client = TestSite.GetHttpClient();
Crawler = new Crawler(client, new ParallelAsyncTaskHandler());
}

[Benchmark]
public async Task CrawlSite()
{
var result = await Crawler.Crawl(Uri, new CrawlSettings
{
TaskHandlerOptions = new TaskHandlerOptions
{
MaxNumberOfSimultaneousTasks = 5,
DelayBetweenTaskStart = new TimeSpan(),
DelayJitter = new TimeSpan(),
TimeoutBeforeThrottle = new TimeSpan()
}
});
}
}
}
@@ -0,0 +1,18 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFrameworks>netcoreapp2.1;net461</TargetFrameworks>
<IsPackable>false</IsPackable>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="BenchmarkDotNet" Version="0.11.3" />
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\..\src\InfinityCrawler\InfinityCrawler.csproj" />
<ProjectReference Include="..\InfinityCrawler.Tests.TestSite\InfinityCrawler.Tests.TestSite.csproj" />
</ItemGroup>

</Project>
@@ -0,0 +1,13 @@
using System;
using BenchmarkDotNet.Running;

namespace InfinityCrawler.Tests.Benchmarks
{
class Program
{
static void Main(string[] args)
{
BenchmarkRunner.Run<BasicSiteCrawlBenchmark>();
}
}
}

0 comments on commit bbd7d48

Please sign in to comment.
You can’t perform that action at this time.