Skip to content

Commit

Permalink
Improve performance of benchmark itself
Browse files Browse the repository at this point in the history
  • Loading branch information
hmG3 committed Mar 2, 2024
1 parent 24a40fd commit 4e13263
Show file tree
Hide file tree
Showing 7 changed files with 214 additions and 129 deletions.
44 changes: 44 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
root=true

[*]

#### Core EditorConfig Options ####

# Indentation and spacing
indent_style=space
indent_size=2
trim_trailing_whitespace=true
charset=utf-8
max_line_length=140

# New line preferences
insert_final_newline=true

#### .NET Coding Conventions ####

[*.cs]

indent_size=4

# Microsoft .NET properties
dotnet_separate_import_directive_groups=false
dotnet_sort_system_directives_first=true
dotnet_style_predefined_type_for_locals_parameters_members=true:suggestion
dotnet_style_predefined_type_for_member_access=false:suggestion
csharp_new_line_before_open_brace=all
csharp_new_line_before_else=true
csharp_space_after_cast=true
csharp_space_after_keywords_in_control_flow_statements=true
dotnet_style_collection_initializer=true:suggestion
dotnet_style_object_initializer=true:suggestion
csharp_style_var_when_type_is_apparent=true:suggestion
csharp_style_expression_bodied_methods=true:suggestion
csharp_prefer_braces=true:warning

# ReSharper properties
resharper_place_accessorholder_attribute_on_same_line=false
resharper_csharp_wrap_after_declaration_lpar=true
resharper_csharp_wrap_parameters_style=chop_if_long
resharper_max_formal_parameters_on_line=3
resharper_blank_lines_around_single_line_auto_property=1
resharper_csharp_keep_blank_lines_in_declarations=1
13 changes: 0 additions & 13 deletions src/TaTooIne.Benchmark/BenchmarkColumnProvider.cs

This file was deleted.

30 changes: 0 additions & 30 deletions src/TaTooIne.Benchmark/BenchmarkConfig.cs

This file was deleted.

6 changes: 3 additions & 3 deletions src/TaTooIne.Benchmark/BenchmarkOrderer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ private BenchmarkOrderer()

public IEnumerable<BenchmarkCase> GetExecutionOrder(
ImmutableArray<BenchmarkCase> benchmarkCases,
IEnumerable<BenchmarkLogicalGroupRule> _)
IEnumerable<BenchmarkLogicalGroupRule>? _)
{
return benchmarkCases
.OrderBy(b => b.Parameters["order"])
Expand All @@ -34,7 +34,7 @@ public IEnumerable<BenchmarkCase> GetSummaryOrder(
foreach (var logicalGroup in GetLogicalGroupOrder(benchmarkLogicalGroups,
Enumerable.Empty<BenchmarkLogicalGroupRule>()))
{
foreach (var benchmark in logicalGroup.OrderBy(b => summary[b].ResultStatistics?.Mean ?? 0d))
foreach (var benchmark in logicalGroup.OrderBy(b => summary[b]!.ResultStatistics?.Mean ?? 0d))
{
yield return benchmark;
}
Expand All @@ -53,7 +53,7 @@ public string GetLogicalGroupKey(ImmutableArray<BenchmarkCase> _, BenchmarkCase

public IEnumerable<IGrouping<string, BenchmarkCase>> GetLogicalGroupOrder(
IEnumerable<IGrouping<string, BenchmarkCase>> logicalGroups,
IEnumerable<BenchmarkLogicalGroupRule> _)
IEnumerable<BenchmarkLogicalGroupRule>? _)
{
return logicalGroups;
}
Expand Down
19 changes: 19 additions & 0 deletions src/TaTooIne.Benchmark/BenchmarkParamsColumnProvider.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
using BenchmarkDotNet.Columns;
using BenchmarkDotNet.Reports;

namespace TaTooIne.Benchmark;

internal sealed class BenchmarkParamsColumnProvider : IColumnProvider
{
private BenchmarkParamsColumnProvider()
{
}

public static BenchmarkParamsColumnProvider Instance { get; } = new();

public IEnumerable<IColumn> GetColumns(Summary summary) =>
summary.BenchmarksCases
.SelectMany(c => c.Parameters.Items.Select(item => item.Definition))
.Where(c => c.Name != "order")
.Select(definition => new ParamColumn(definition.Name, definition.PriorityInCategory));
}
Loading

0 comments on commit 4e13263

Please sign in to comment.