Skip to content

Commit

Permalink
Update nuget packages + add Dark theme support to HTMLs
Browse files Browse the repository at this point in the history
  • Loading branch information
mjebrahimi committed Aug 16, 2024
1 parent d243738 commit c0f1c13
Show file tree
Hide file tree
Showing 22 changed files with 5,065 additions and 4,538 deletions.
4 changes: 2 additions & 2 deletions DotNet-Collections-Benchmark.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="BenchmarkDotNet" Version="0.13.12" />
<PackageReference Include="BenchmarkDotNetVisualizer" Version="1.0.7" />
<PackageReference Include="BenchmarkDotNet" Version="0.14.0" />
<PackageReference Include="BenchmarkDotNetVisualizer" Version="2.0.1" />
<PackageReference Include="Shouldly" Version="4.2.1" />
<PackageReference Include="DeepEqual" Version="5.1.0" />
</ItemGroup>
Expand Down
21 changes: 12 additions & 9 deletions Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -44,27 +44,28 @@ static async Task VisualizeInitializeBenchmarks(BenchmarkInfo[] benchmarkInfo)
Title = null!, //Set per case
MainColumn = "Method",
GroupByColumns = ["Length", "Sorted"],
PivotProperty = "DataType",
PivotColumn = "DataType",
StatisticColumns = null!, //Set per case
ColumnsOrder = ["Int32", "String", "StructInts", "ClassInts", "RecordStructInts", "RecordClassInts", "StructStrings", "ClassStrings", "RecordStructStrings", "RecordClassStrings"],
SpectrumStatisticColumn = true,
HighlightGroups = true,
DividerMode = RenderTableDividerMode.SeparateTables,
HtmlWrapMode = HtmlDocumentWrapMode.RichDataTables,
Theme = Theme.Light
};

options.Title = "Benchmark of Collection Initializing in terms of Execution Time (Mean)";
options.StatisticColumns = ["Mean"];
await benchmarkInfo.JoinReportsAndSaveAsHtmlAndImageAsync(
htmlPath: DirectoryHelper.GetPathRelativeToProjectDirectory("docs\\Benchmark-Initialize-Mean.html"),
imagePath: DirectoryHelper.GetPathRelativeToProjectDirectory("docs\\Benchmark-Initialize-Mean.webp"),
imagePath: DirectoryHelper.GetPathRelativeToProjectDirectory("docs\\Benchmark-Initialize-Mean.png"),
options: options);

options.Title = "Benchmark of Collection Initializing in terms of Allocation Size";
options.StatisticColumns = ["Allocated"];
await benchmarkInfo.JoinReportsAndSaveAsHtmlAndImageAsync(
htmlPath: DirectoryHelper.GetPathRelativeToProjectDirectory("docs\\Benchmark-Initialize-Allocated.html"),
imagePath: DirectoryHelper.GetPathRelativeToProjectDirectory("docs\\Benchmark-Initialize-Allocated.webp"),
imagePath: DirectoryHelper.GetPathRelativeToProjectDirectory("docs\\Benchmark-Initialize-Allocated.png"),
options: options);
}

Expand All @@ -80,28 +81,29 @@ static async Task VisualizeContainsBenchmarks(BenchmarkInfo[] benchmarkInfo)
Title = null!, //Set per case
MainColumn = "Method",
GroupByColumns = ["Existed"],
PivotProperty = "DataType",
PivotColumn = "DataType",
StatisticColumns = null!, //Set per case
OtherColumnsToSelect = ["Big O", "Length"],
ColumnsOrder = ["Int32", "String", "StructInts", "ClassInts", "RecordStructInts", "RecordClassInts", "StructStrings", "ClassStrings", "RecordStructStrings", "RecordClassStrings"],
SpectrumStatisticColumn = true,
HighlightGroups = true,
DividerMode = RenderTableDividerMode.SeparateTables,
HtmlWrapMode = HtmlDocumentWrapMode.RichDataTables,
Theme = Theme.Light
};

options.Title = "Benchmark of Collection Searching (Contains method) in terms of Execution Time (Mean)";
options.StatisticColumns = ["Mean"];
await benchmarkInfo.JoinReportsAndSaveAsHtmlAndImageAsync(
htmlPath: DirectoryHelper.GetPathRelativeToProjectDirectory("docs\\Benchmark-SearchContains-Mean.html"),
imagePath: DirectoryHelper.GetPathRelativeToProjectDirectory("docs\\Benchmark-SearchContains-Mean.webp"),
imagePath: DirectoryHelper.GetPathRelativeToProjectDirectory("docs\\Benchmark-SearchContains-Mean.png"),
options: options);

options.Title = "Benchmark of Collection Searching (Contains method) in terms of Allocation Size";
options.StatisticColumns = ["Allocated"];
await benchmarkInfo.JoinReportsAndSaveAsHtmlAndImageAsync(
htmlPath: DirectoryHelper.GetPathRelativeToProjectDirectory("docs\\Benchmark-SearchContains-Allocated.html"),
imagePath: DirectoryHelper.GetPathRelativeToProjectDirectory("docs\\Benchmark-SearchContains-Allocated.webp"),
imagePath: DirectoryHelper.GetPathRelativeToProjectDirectory("docs\\Benchmark-SearchContains-Allocated.png"),
options: options);
}

Expand All @@ -117,28 +119,29 @@ static async Task VisualizeTryGetValueBenchmarks(BenchmarkInfo[] benchmarkInfo)
Title = null!, //Set per case
MainColumn = "Method",
GroupByColumns = ["Existed"],
PivotProperty = "DataType",
PivotColumn = "DataType",
StatisticColumns = null!, //Set per case
OtherColumnsToSelect = ["Big O", "Length"],
ColumnsOrder = ["Int32", "String", "StructInts", "ClassInts", "RecordStructInts", "RecordClassInts", "StructStrings", "ClassStrings", "RecordStructStrings", "RecordClassStrings"],
SpectrumStatisticColumn = true,
HighlightGroups = true,
DividerMode = RenderTableDividerMode.SeparateTables,
HtmlWrapMode = HtmlDocumentWrapMode.RichDataTables,
Theme = Theme.Light
};

options.Title = "Benchmark of Collection Searching (TryGetValue method) in terms of Execution Time (Mean)";
options.StatisticColumns = ["Mean"];
await benchmarkInfo.JoinReportsAndSaveAsHtmlAndImageAsync(
htmlPath: DirectoryHelper.GetPathRelativeToProjectDirectory("docs\\Benchmark-SearchTryGetValue-Mean.html"),
imagePath: DirectoryHelper.GetPathRelativeToProjectDirectory("docs\\Benchmark-SearchTryGetValue-Mean.webp"),
imagePath: DirectoryHelper.GetPathRelativeToProjectDirectory("docs\\Benchmark-SearchTryGetValue-Mean.png"),
options: options);

options.Title = "Benchmark of Collection Searching (TryGetValue method) in terms of Allocation Size";
options.StatisticColumns = ["Allocated"];
await benchmarkInfo.JoinReportsAndSaveAsHtmlAndImageAsync(
htmlPath: DirectoryHelper.GetPathRelativeToProjectDirectory("docs\\Benchmark-SearchTryGetValue-Allocated.html"),
imagePath: DirectoryHelper.GetPathRelativeToProjectDirectory("docs\\Benchmark-SearchTryGetValue-Allocated.webp"),
imagePath: DirectoryHelper.GetPathRelativeToProjectDirectory("docs\\Benchmark-SearchTryGetValue-Allocated.png"),
options: options);
}

Expand Down
19 changes: 10 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,38 +40,39 @@ If you find this repository useful and like it, why not give it a star? if not,

### Benchmark of Collection Initializing in terms of Execution Time (Mean)

- Visit [HTML Page](https://mjebrahimi.github.io/DotNet-Collections-Benchmark/Benchmark-Initialize-Mean.html)
- Visit [Full Image](https://mjebrahimi.github.io/DotNet-Collections-Benchmark/Benchmark-Initialize-Mean.png)
- **Visit [HTML Page](https://mjebrahimi.github.io/DotNet-Collections-Benchmark/Benchmark-Initialize-Mean.html)**
- **Visit [Full Image](https://mjebrahimi.github.io/DotNet-Collections-Benchmark/Benchmark-Initialize-Mean.png)**

![Benchmark-Initialize-Mean-Preview](https://mjebrahimi.github.io/DotNet-Collections-Benchmark/Benchmark-Initialize-Mean-Preview.png)

### Benchmark of Collection Initializing in terms of Allocation Size

- Visit [HTML Page](https://mjebrahimi.github.io/DotNet-Collections-Benchmark/Benchmark-Initialize-Allocated.html)
- Visit [Full Image](https://mjebrahimi.github.io/DotNet-Collections-Benchmark/Benchmark-Initialize-Allocated.png)
- **Visit [HTML Page](https://mjebrahimi.github.io/DotNet-Collections-Benchmark/Benchmark-Initialize-Allocated.html)**
- **Visit [Full Image](https://mjebrahimi.github.io/DotNet-Collections-Benchmark/Benchmark-Initialize-Allocated.png)**

![Benchmark-Initialize-Allocated-Preview](https://mjebrahimi.github.io/DotNet-Collections-Benchmark/Benchmark-Initialize-Allocated-Preview.png)

### Benchmark of Collection Searching (TryGetValue method) in terms of Execution Time (Mean)

- Visit [HTML Page](https://mjebrahimi.github.io/DotNet-Collections-Benchmark/Benchmark-SearchTryGetValue-Mean.html)
- Visit [Full Image](https://mjebrahimi.github.io/DotNet-Collections-Benchmark/Benchmark-SearchTryGetValue-Mean.png)
- **Visit [HTML Page](https://mjebrahimi.github.io/DotNet-Collections-Benchmark/Benchmark-SearchTryGetValue-Mean.html)**
- **Visit [Full Image](https://mjebrahimi.github.io/DotNet-Collections-Benchmark/Benchmark-SearchTryGetValue-Mean.png)**

![Benchmark-SearchTryGetValue-Mean-Preview](https://mjebrahimi.github.io/DotNet-Collections-Benchmark/Benchmark-SearchTryGetValue-Mean-Preview.png)

### Benchmark of Collection Searching (TryGetValue method) in terms of Allocation Size

- Visit [HTML Page](https://mjebrahimi.github.io/DotNet-Collections-Benchmark/Benchmark-SearchTryGetValue-Allocated.html)
- Visit [Full Image](https://mjebrahimi.github.io/DotNet-Collections-Benchmark/Benchmark-SearchTryGetValue-Allocated.png)
- **Visit [HTML Page](https://mjebrahimi.github.io/DotNet-Collections-Benchmark/Benchmark-SearchTryGetValue-Allocated.html)**
- **Visit [Full Image](https://mjebrahimi.github.io/DotNet-Collections-Benchmark/Benchmark-SearchTryGetValue-Allocated.png)**

![Benchmark-SearchTryGetValue-Allocated-Preview](https://mjebrahimi.github.io/DotNet-Collections-Benchmark/Benchmark-SearchTryGetValue-Allocated-Preview.png)

## BenchmarkDotNetVisualizer🌈

All the benchmarks are visualized using [BenchmarkDotNetVisualizer](https://github.com/mjebrahimi/BenchmarkDotNetVisualizer).
All the benchmarks are created by [BenchmarkDotNetVisualizer](https://github.com/mjebrahimi/BenchmarkDotNetVisualizer).

## Todo

- [ ] Add .NET 9.0 **OrderedDictionary** to the benchmarks
- [ ] Add benchmarks for other operations such as **Add**, **Insert**, **Remove**, and **Update**.

## Useful Resources
Expand Down
Loading

0 comments on commit c0f1c13

Please sign in to comment.