feat: Early load ustr by lym953 · Pull Request #792 · DataDog/datadog-lambda-extension
Problem
The first time Ustr::from() is called, it takes 10+ ms to init. Right now this is on the critical path and adds to cold start time.
This PR
Start it early in a separate thread, so when it is needed later, it will be already initialized.
Result
Using extensiononly stack on Node 22:
Before
Datadog Next-Gen Extension ready in: 54.1 ±2.2 ms (95% confidence interval, 21 data points)Metrics aggregator created in: 10+ ms (10,000+ us)
After
Datadog Next-Gen Extension ready in: 49.7±1.9 ms (95% confidence level, 10 data points)Metrics aggregator created in: 277±186 us (95% confidence level, 10 data points)
Thanks @duncanista for identifying this performance bottleneck!
Jira: https://datadoghq.atlassian.net/browse/SVLS-7456