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

Optimize TimestampTokenRenderer #134

Merged
merged 2 commits into from
Jan 6, 2023
Merged

Optimize TimestampTokenRenderer #134

merged 2 commits into from
Jan 6, 2023

Conversation

sungam3r
Copy link
Contributor

@sungam3r sungam3r commented Dec 2, 2022

Saves some allocations:

  1. Instance of ScalarValue.
  2. Boxing logEvent.Timestamp into object.
  3. DateTimeOffset -> string convertions when calling ScalarValue.Value.ToString() from ScalarValue.Render.

Copy link
Member

@nblumhardt nblumhardt left a comment

Choose a reason for hiding this comment

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

Looks great! Nice clean wins there 👍

return;
}

#if NET5_0_OR_GREATER
Copy link
Member

Choose a reason for hiding this comment

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

Could we follow the Serilog convention of declaring feature flag use in the CSPROJ (i.e. FEATURE_SPAN) for this, here: https://github.com/serilog/serilog-sinks-console/blob/dev/src/Serilog.Sinks.Console/Serilog.Sinks.Console.csproj#L26 ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done

@nblumhardt nblumhardt merged commit 49df3e6 into serilog:dev Jan 6, 2023
@sungam3r sungam3r deleted the opt branch January 13, 2023 21:15
@nblumhardt nblumhardt mentioned this pull request Nov 9, 2023
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