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
Don't use viper.Get* in tight loops #2495
Comments
I have "suggested" this for the 0.17 release -- but it is probably a more natural fit for the next ... My PR isn't entirely finished, but I will wrap it up during the day. I'm not sure why Viper allocates memory on a simple
/cc @spf13 |
Also see spf13/viper#242 |
With the fix in
|
I like your PathSpec approach. I was thinking along the same lines when I first saw this issue, but with your fix in |
I have another simple fix for Viper coming that will improve this even further. |
This is the delta after the latest Viper update:
Still worth doing, but not super-important anymore. |
The gain, given the "real sites benchmark" below, is obvious: ``` benchmark old ns/op new ns/op delta BenchmarkHugo-4 14497594101 13084156335 -9.75% benchmark old allocs new allocs delta BenchmarkHugo-4 57404335 48282002 -15.89% benchmark old bytes new bytes delta BenchmarkHugo-4 9933505624 9721984424 -2.13% ``` Fixes gohugoio#2495
The gain, given the "real sites benchmark" below, is obvious: ``` benchmark old ns/op new ns/op delta BenchmarkHugo-4 14497594101 13084156335 -9.75% benchmark old allocs new allocs delta BenchmarkHugo-4 57404335 48282002 -15.89% benchmark old bytes new bytes delta BenchmarkHugo-4 9933505624 9721984424 -2.13% ``` Fixes #2495
The gain, given the "real sites benchmark" below, is obvious: ``` benchmark old ns/op new ns/op delta BenchmarkHugo-4 14497594101 13084156335 -9.75% benchmark old allocs new allocs delta BenchmarkHugo-4 57404335 48282002 -15.89% benchmark old bytes new bytes delta BenchmarkHugo-4 9933505624 9721984424 -2.13% ``` Fixes gohugoio#2495
This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
Profiling indicate that using
viper.GetBool
inside the url funcs (MakePath etc.) have a surprising cost.Just removing one viper.Get temporary from
MakePathSanitized
:The text was updated successfully, but these errors were encountered: