-
-
Notifications
You must be signed in to change notification settings - Fork 123
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Sorts docs by id for, don't cast, less allocations for better perf. U…
…pdates benchmarks and adds TODOs
- Loading branch information
Showing
10 changed files
with
307 additions
and
39 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Text; | ||
using System.Threading.Tasks; | ||
using BenchmarkDotNet.Running; | ||
using Microsoft.Diagnostics.Tracing.Parsers.Kernel; | ||
|
||
namespace Examine.Benchmarks | ||
{ | ||
public class Program | ||
{ | ||
public static async Task Main(string[] args) | ||
{ | ||
#if RELEASE | ||
// Benchmark your function here. | ||
BenchmarkSwitcher.FromAssembly(typeof(Program).Assembly).Run(args); | ||
#else | ||
var bench = new ConcurrentSearchBenchmarks(); | ||
try | ||
{ | ||
bench.Setup(); | ||
await Threads100(bench); | ||
await Threads1(bench); | ||
} | ||
finally | ||
{ | ||
bench.TearDown(); | ||
} | ||
|
||
#endif | ||
// Call your function here. | ||
} | ||
|
||
private static async Task Threads100(ConcurrentSearchBenchmarks bench) | ||
{ | ||
bench.ThreadCount = 50; | ||
bench.MaxResults = 10; | ||
|
||
for (var i = 0; i < 100; i++) | ||
{ | ||
await bench.ExamineStandard(); | ||
} | ||
} | ||
|
||
private static async Task Threads1(ConcurrentSearchBenchmarks bench) | ||
{ | ||
bench.ThreadCount = 1; | ||
bench.MaxResults = 10; | ||
|
||
for (var i = 0; i < 100; i++) | ||
{ | ||
await bench.ExamineStandard(); | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.