-
-
Notifications
You must be signed in to change notification settings - Fork 1k
Open
Description
Hi. I'm trying to test performance of some ILogger extensions that use a lot of lambdas.
Benchmarks has the following structure
[HtmlExporter]
[MarkdownExporter]
[MemoryDiagnoser]
[MaxColumn, MinColumn, MeanColumn]
public class LoggingBenchmark
{
MyLogger _logger = new();
[GlobalSetup]
public void GlobalSetup()
{
_logger = new MyLogger();
}
// [IterationSetup]
public void IterationSetup()
{
}
[Params(1, 10, 100, 1000)]
public int Depth { get; set; }
[Benchmark]
public Task<int> Logger_ExecuteAsync()
{
return Helper.RunRecursively_ExecuteAsync(_logger, Depth);
}
}
The helper method is the equivalent of
Task<int> RunRecursively_ExecuteAsync(ILogger logger, int depth)
{
return logger.ExecuteAsync(async () =>
{
return depth == 0 ? 42 : await RunRecursively_ExecuteAsync(logger, depth - 1);
})
}
ExecuteAsync is just an extension that does try/catch around async action and logs some stuff
For some reason i'm getting stack overflow exception when uncommenting // [IterationSetup] attribute, even though the method is empty.
Any immediate thoughts about the difference, before i invest into making full repro? Looks a bit odd on my end
StackOverflow is obviously for the Depth = 1000 case, runs out of stack arfet 800 or so.
BenchmarkDotNet version: 0.14.0
Metadata
Metadata
Assignees
Labels
No labels