Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Lazily Instantiate ConcurrentDictionaries to improve performance #934

Closed
cijothomas opened this issue Oct 3, 2018 · 0 comments
Closed
Assignees
Milestone

Comments

@cijothomas
Copy link
Contributor

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) :

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

No branches or pull requests

1 participant