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

Improve performance using reference, not cloning #1

Open
mathbalduino opened this issue Oct 15, 2021 · 2 comments
Open

Improve performance using reference, not cloning #1

mathbalduino opened this issue Oct 15, 2021 · 2 comments
Labels
enhancement New feature or request

Comments

@mathbalduino
Copy link
Owner

mathbalduino commented Oct 15, 2021

The performance (may be) improved if the logger holds a reference to it's parent, instead of cloning the entire base fields, preHooks, postHooks and outputs slices/maps.

At the useReference branch, there's some suggestion:

type hooksChain struct {
	parent *hooksChain
	hooks  Hooks
}

If this struct is used inside the logger struct, replacing the old baseFields, preHooks/postHooks and outputs field types, they will continue to have the same behavior.

@mathbalduino mathbalduino added the enhancement New feature or request label Aug 3, 2023
@mathbalduino mathbalduino changed the title (maybe) Improve performance using reference, not clonage Improve performance using reference, not clonage Aug 3, 2023
@mathbalduino
Copy link
Owner Author

This will only help async loggers, since the work still needs to be done. It may be even worse, because we'll need to use no-tail recursion.

We're basically just moving the overhead from the log cloning to the post-hooks phase, that may be executed asynchronously...

@mathbalduino mathbalduino changed the title Improve performance using reference, not clonage Improve performance using reference, not cloning Aug 3, 2023
@mathbalduino
Copy link
Owner Author

useReference branch was deleted, because it was too old. Do it from scratch, if it is really needed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant