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

Precompute decode hooks for performance reason #324

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

Succo
Copy link

@Succo Succo commented Apr 14, 2023

When using this library with ComposeDecodeHook we noticed some performance degration. After further investigation, it seems that a lot of time is spent inside typedDecodeHook on reflect func.

I think it would be possible to precompute the typedDecodeHook for all hooks given to ComposeDecodeHook. I applied the same patch to OrComposeDecodeHookFunc event though we don't use it.

@Succo
Copy link
Author

Succo commented Apr 14, 2023

Some of the comments got updated due to gofmt change in behaviour.

I can revert this part if it's a problem (or open a different PR just for it)

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.

None yet

1 participant