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

LogRecord Attributes - avoid heap allocations #1920

Closed
cijothomas opened this issue Jul 9, 2024 · 1 comment
Closed

LogRecord Attributes - avoid heap allocations #1920

cijothomas opened this issue Jul 9, 2024 · 1 comment
Assignees
Labels
A-log Area: Issues related to logs

Comments

@cijothomas
Copy link
Member

We recently decided to pre-allocate up to 8 attributes, to avoid reallocation/copy costs, but attributes are still always on the heap.
Opening an issue to track improving this, so that, up to 8 attributes can be stack allocated, and then fallback to heap for more attributes. This, along with #1919, allow one to write logs without any allocation when using synchronous exporters like etw/user_events that require no batching.

We could add a dependency on SmallVec or make a home-grown solution. For an example implementation, .NET's TagList can be referred, which optimizes for up to 8 attributes.

We may need a feature flag to control this, as some scenarios (eg: Kernel mode) has less stack available.

@lalitb
Copy link
Member

lalitb commented Aug 27, 2024

fixed in #1965 . The feature flag as discussed in #2055 would be added as required. Will create a separate issue for supporting kernel mode applications.

@lalitb lalitb closed this as completed Aug 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-log Area: Issues related to logs
Projects
None yet
2 participants