mapstructure icon indicating copy to clipboard operation
mapstructure copied to clipboard

Precompute decode hooks for performance reason

Open Succo opened this issue 2 years ago • 2 comments

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 avatar Apr 14 '23 07:04 Succo

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)

Succo avatar Apr 14 '23 09:04 Succo

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

cedric-cordenier avatar Jun 24 '24 11:06 cedric-cordenier