Sitelet https://github.com/microsoft/ApplicationInsights-dotnet/issues/934
Skip to content

Lazily Instantiate ConcurrentDictionaries to improve performance #934

Description

In TelemetryContext, and in auto-generated constructors of each base telemetry item, ConcurrentDictionaries are created for each telemetry item creation. This is a perf hit as ConcurrentDictionaries are expensive to create, and in most cases, the item is sampled out, so this ConccurentDictionary allocation is wasted.

https://github.com/Microsoft/ApplicationInsights-dotnet/blob/develop/src/Microsoft.ApplicationInsights/DataContracts/TelemetryContext.cs#L42

https://github.com/Microsoft/ApplicationInsights-dotnet/blob/develop/src/Microsoft.ApplicationInsights/Extensibility/Implementation/External/AvailabilityData_types.cs#L97

Proposal is to make the ConcurrentDictionary creation lazy, and improve performance.

Version Info

SDK Version :
.NET Version :
How Application was onboarded with SDK(VisualStudio/StatusMonitor/Azure Extension) :
OS :
Hosting Info (IIS/Azure WebApps/ etc) :

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions