Skip to content

Conversation

@dqminh
Copy link
Contributor

@dqminh dqminh commented Sep 1, 2025

In async heavy code, Box::pin contributes a large percentage of allocation time. We can switch to pin_project to remove Box::pin usage here.

This allows user to skip the boxing step and save a memory allocation.
This is configure with generic=true in attribute. For example

 #[span_fn("async_trait_span", generic = true)]

@dqminh dqminh force-pushed the telemetry-context-pin branch 2 times, most recently from 48f49c6 to 73ccf73 Compare September 4, 2025 11:54
@dqminh dqminh force-pushed the telemetry-context-pin branch from 73ccf73 to 998ce3c Compare September 10, 2025 12:57
@dqminh dqminh force-pushed the telemetry-context-pin branch 2 times, most recently from 4300027 to 174dc2e Compare September 16, 2025 10:27
This allows user to skip the boxing step and save a memory allocation.
This is configure with `generic=true` in attribute. For example

```
 #[span_fn("async_trait_span", generic = true)]
```

Also add a cfg `foundations_generic_telemetry_wrapper` so user can enable this
behavior by default.
@TheJokr TheJokr force-pushed the telemetry-context-pin branch from 174dc2e to 1f8c68a Compare September 16, 2025 16:03
@TheJokr
Copy link
Collaborator

TheJokr commented Sep 16, 2025

Rebased to make CI pass, one of the tests is flaky (#136)

@TheJokr TheJokr merged commit 7cb43f3 into cloudflare:main Sep 16, 2025
18 checks passed
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