Skip to content

Performance degradation with deep call stacks (>50 frames) #9

@hokagedami

Description

@hokagedami

Issue Description

I'm experiencing significant performance issues when using the CallStack enricher with deep call stacks containing more than 50 frames. The enricher seems to process each frame individually without any optimization.

Environment

  • Serilog.Enrichers.CallStack: v1.0.353
  • .NET 6.0
  • Windows 11

Expected Behavior

Call stack enrichment should maintain reasonable performance even with deep stacks.

Actual Behavior

Processing time increases exponentially with stack depth. With 100+ frame stacks, enrichment takes >500ms.

Reproduction Code

Log.Logger = new LoggerConfiguration()
    .Enrich.WithCallStack()
    .WriteTo.Console()
    .CreateLogger();

// Deep recursion scenario
RecursiveMethod(100);

Would appreciate any insights on optimization strategies or configuration options to limit stack depth.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions