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

Reduce overhead from using RaygunBreadcrumb by lazy allocation of CustomData #524

Merged
merged 2 commits into from
Mar 19, 2024

Conversation

snakefoot
Copy link
Contributor

@snakefoot snakefoot commented Mar 18, 2024

Also skip StackTrace probing, when BreadCrumb is prefilled.

Copy link
Contributor

@phillip-haydon phillip-haydon left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for the PR. I've reviewed it, generally happy with the changes, just missing braces on the if statement kicking off my OCD :)

Do have 1 question in regards to not using .ToList();

Mindscape.Raygun4Net4/Breadcrumbs/RaygunBreadcrumbs.cs Outdated Show resolved Hide resolved
@@ -439,7 +439,7 @@ public void SendInBackground(Func<RaygunMessage> raygunMessage)
private void StripAndSend(Exception exception, IList<string> tags, IDictionary userCustomData, RaygunIdentifierMessage userInfo, DateTime? currentTime)
{
var requestMessage = BuildRequestMessage();
var breadcrumbs = _breadcrumbs.ToList();
IList<RaygunBreadcrumb> breadcrumbs = BuildBreadCrumbList();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Curious to know why this is better than calling .ToList() ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

_breadcrumbs.ToList() will allocate an enumerator and a List-object. The BuildBreadCrumbList() will also allocate an enumerator, but only allocate a List-object when breadcrumbs are found.

Level = RaygunBreadcrumbLevel.Info;
Type = RaygunBreadcrumbType.Manual.ToString();
Type = nameof(RaygunBreadcrumbType.Manual);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Love this, I always forget to do it.

Copy link
Contributor

@phillip-haydon phillip-haydon left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for the PR!

@phillip-haydon phillip-haydon merged commit 9850f95 into MindscapeHQ:master Mar 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants