Bug 1951357 - Use a SmallVec for Rust marker payloads to avoid unnecessary allocations for most markers r=mstange,profiler-reviewers,aabh,jrmuizel

We've seen in the past that bincode::serialize was spending too much time
allocating and deallocating a Vec to return the serialized payload.

Instead now, we are creating a SmallVec with 64 bytes inline storage, which is
enough for most of our markers for today. This way, SmallVec will try to keep
payloads inside the stack, and it will only allocate if it goes above 64 bytes.

Differential Revision: https://phabricator.services.mozilla.com/D240150
This commit is contained in:
Nazım Can Altınova
2025-03-04 18:20:54 +00:00
parent 5a6fc7a77b
commit c2ec9c741b
3 changed files with 18 additions and 5 deletions

1
Cargo.lock generated
View File

@@ -2266,6 +2266,7 @@ dependencies = [
"mozbuild",
"profiler-macros",
"serde",
"smallvec",
]
[[package]]