Skip to content
This repository has been archived by the owner on Jul 22, 2024. It is now read-only.

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)

@cedric-cordenier
Copy link

@mitchellh We've noticed the same performance issues as @Succo . Are there any plans to merge this?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants