Skip to content

DiagnosticListener performance optimization #20211

@lmolkova

Description

@lmolkova

Motivation

It is motivated as a performance optimization. The IsEnabled() with no arguments allow a inlinable quick check for performance reasons.

Details

Add DiagnoticListener.IsEnabled() without arguments as an initial loose check that returns true if there is a subscriber to DiagnosticListener (suggested in dotnet/corefx#15971).

API proposal

public bool IsEnabled() {return _subscriptions != null;};

/cc @vancem @stephentoub

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions