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 - preallocate attributes vec? #1896

Closed
cijothomas opened this issue Jun 27, 2024 · 3 comments · Fixed by #1908
Closed

LogRecord Attributes - preallocate attributes vec? #1896

cijothomas opened this issue Jun 27, 2024 · 3 comments · Fixed by #1908
Assignees

Comments

@cijothomas
Copy link
Member

image
Since we don't pre-allocate, the vec starts with size 1, and often requires re-allocating. Would we start with a default size of, say 5?
(don't ask me why 5, just a magic number!)

Opening an issue to track this improvement. The change can improve current throughput, benchmark by 10-20% (as they all need ~5 attributes.)

@lalitb
Copy link
Member

lalitb commented Jun 27, 2024

Thanks, let's track this potential improvement with benchmark of both memory and throughput while handling this.

@cijothomas
Copy link
Member Author

From 7/2 SIG meeting:
Start with default = 8.
In future, we can make it configurable, if we chose to and there is demand.

@lalitb
Copy link
Member

lalitb commented Jul 2, 2024

I think we discussed it earlier - If we plan to start with default size, we can also evaluate using smallvec, to allocate this initial capacity on stack. tokio-tracing is doing something similar for the metrics attributes.

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 a pull request may close this issue.

2 participants