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

hugolib, tpl: Get rid of some redundant viper calls #3292

Closed
wants to merge 2 commits into
base: master
from

Conversation

Projects
None yet
2 participants
@bogem
Contributor

bogem commented Apr 6, 2017

markdownify template function needs less time now to markdownify pages.

Count of viper calls by building https://github.com/rdwatters/hugo-docs-concept

 962 publishdir
 749 pygmentscodefences
 650 defaultcontentlanguage
 645 languages
 640 builddrafts
 638 buildfuture
 638 buildexpired
 342 ignorefiles
 315 hascjklanguage
 313 enableemoji
 261 rsslimit
 261 disablerss
   9 rssuri
   5 defaultContentLanguage
   4 uglyurls
   4 theme
   4 taxonomies
   4 multilingual
   4 ignorecache
   4 defaultcontentlanguageinsubdir
   4 canonifyurls
   4 cachedir
   4 baseurl
   3 workingdir
   3 themesdir
   3 staticdir
   3 removepathaccents
   3 paginatepath
   3 layoutdir
   3 disablepathtolower
   2 workingDir
   2 themesDir
   2 contentdir
   2 blackfriday
   1 verbose
   1 uglyURLs
   1 title
   1 staticDir
   1 social
   1 sitemap
   1 sectionpagesmenu
   1 removePathAccents
   1 relativeurls
   1 relativeURLs
   1 publishDir
   1 preservetaxonomynames
   1 pluralizelisttitles
   1 permalinks
   1 params
   1 paginatePath
   1 noTimes
   1 noChmod
   1 menu
   1 logFile
   1 layoutDir
   1 languagecode
   1 i18ndir
   1 googleanalytics
   1 footnotereturnlinkcontents
   1 footnoteanchorprefix
   1 footnoteReturnLinkContents
   1 footnoteAnchorPrefix
   1 enablerobotstxt
   1 enablemissingtranslationplaceholders
   1 enablegitinfo
   1 disqusshortname
   1 disablesitemap
   1 disablekinds
   1 disablehugogeneratorinject
   1 disablePathToLower
   1 disable404
   1 defaultContentLanguageInSubdir
   1 datadir
   1 copyright
   1 cleanDestinationDir
   1 canonifyURLs
   1 cacheDir
   1 baseURL
   1 author

Performance gain: about 0.5-1 sec by building hugodocs.info on my MacBook Air 2014/1,4 GHz Intel Core i5/4 GB 1600 MHz DDR3

Updates #2728
Updates rdwatters/hugo-docs-concept#44

@bep I appreciate if you will provide benchmarks

@bep

This comment has been minimized.

Show comment
Hide comment
@bep

bep Apr 6, 2017

Member

In my tests it saves some allocations compared to current master, but is about the same in speed department (there is an error margin here at about 3 percent or something):

benchmark           old ns/op      new ns/op       delta
BenchmarkHugo-4     9997747579     10140845478     +1.43%

benchmark           old allocs     new allocs     delta
BenchmarkHugo-4     49446752       48760618       -1.39%

benchmark           old bytes      new bytes      delta
BenchmarkHugo-4     9442790920     9433569344     -0.10%

But I guess this depends on what feature the sites I have in my test uses.

Member

bep commented Apr 6, 2017

In my tests it saves some allocations compared to current master, but is about the same in speed department (there is an error margin here at about 3 percent or something):

benchmark           old ns/op      new ns/op       delta
BenchmarkHugo-4     9997747579     10140845478     +1.43%

benchmark           old allocs     new allocs     delta
BenchmarkHugo-4     49446752       48760618       -1.39%

benchmark           old bytes      new bytes      delta
BenchmarkHugo-4     9442790920     9433569344     -0.10%

But I guess this depends on what feature the sites I have in my test uses.

@bogem

This comment has been minimized.

Show comment
Hide comment
@bogem

bogem Apr 6, 2017

Contributor

Thank you!
Hm, then these changes only affect themes that use many markdownify functions

Contributor

bogem commented Apr 6, 2017

Thank you!
Hm, then these changes only affect themes that use many markdownify functions

@bep

This comment has been minimized.

Show comment
Hide comment
@bep

bep Apr 6, 2017

Member

This is, of course, still worth it. I will eventually update my list of sites in my benchmark to be more representative re new features.

Member

bep commented Apr 6, 2017

This is, of course, still worth it. I will eventually update my list of sites in my benchmark to be more representative re new features.

@bogem

This comment has been minimized.

Show comment
Hide comment
@bogem

bogem Apr 6, 2017

Contributor

So can I merge it?

Contributor

bogem commented Apr 6, 2017

So can I merge it?

@bogem

This comment has been minimized.

Show comment
Hide comment
@bogem

bogem Apr 6, 2017

Contributor

Merged in 8f09e5f and 260b55e

Contributor

bogem commented Apr 6, 2017

Merged in 8f09e5f and 260b55e

@bogem bogem closed this Apr 6, 2017

@bogem bogem deleted the bogem:viper branch Apr 6, 2017

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment