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

Minor per-request allocation reduction #65

Merged
merged 1 commit into from
Nov 28, 2023

Conversation

metaleap
Copy link
Contributor

@metaleap metaleap commented Oct 5, 2023

In the middleware handler: the very first init of l zerolog.Logger does not yet depend on the request's c *gin.Context. It need not be allocated at the start of every request, since all later l usage happens anyway only after a new instance is allocated by l.With. With this change, it's inited-and-kept once per gin.Engine.

In the middleware handler: the very first init of `l zerolog.Logger` does not yet depend on the request's `c *gin.Context`. It need not be allocated at the start of every request, since all later `l` usage happens anyway only after a new instance is allocated by `l.With`.
@appleboy appleboy merged commit 4121d9d into gin-contrib:master Nov 28, 2023
@appleboy
Copy link
Member

@metaleap Thanks.

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