Skip to content

Add LambdaRequestID #243

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

Merged
merged 1 commit into from
Dec 11, 2021
Merged

Conversation

fabianfett
Copy link
Member

If we want to minimize allocations for every invocation, we need to look at types that currently allocate. Currently we use a String to hold the request id. However since the request id is a uuid, that string is 36 characters long. This is way above the 15 character string allocation threshold. The go to type in this case would be UUID. However UUID is in Foundation and we want to keep the lambda runtime Foundation free.

This pr introduces a LambdaRequestID to represent a uuid. One nice side effect of having our own uuid case is: We can make writing the uuid-string to a ByteBuffer allocation free (since no intermediate translation to a string is needed first).

This pr does not add any public API.

@fabianfett fabianfett requested a review from tomerd December 10, 2021 13:18
@fabianfett fabianfett force-pushed the ff-request-id branch 2 times, most recently from 10246e2 to d9f70c2 Compare December 10, 2021 13:23
@tomerd
Copy link
Contributor

tomerd commented Dec 10, 2021

lgtm 👍🏼

@fabianfett fabianfett merged commit bc78f60 into swift-server:main Dec 11, 2021
@fabianfett fabianfett added the 🔨 semver/patch No public API change. label Dec 11, 2021
@fabianfett fabianfett deleted the ff-request-id branch December 11, 2021 12:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🔨 semver/patch No public API change.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants