-
-
Notifications
You must be signed in to change notification settings - Fork 7.5k
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
tpl: Add findRE template func #2048
Conversation
What is the performance implications of adding this to a medium sized Hugo site? |
How do you define medium sized? And the more complex the regexp is the longer it takes. Can you suggest a website for a benchmark with a usecase for a regexp? |
With the regexp in the example. Would be valuable to see what adding that to the single template on a couple of hundred pages blog adds in time. |
What do you think if I add the scrollspy example from the docs into the templates for the Hugo pages? Hugo's docs consist of around generated 180 pages. |
Sure, and you don't have to use the result, just invoke the regexp for every page. |
The setup: I copied the content of a file from the docs in the default archetype. Next, I wrote a small bash script that generates 400 new content files (is this medium sized?). Finally, I build the site. The benchmark of course does only include the build time of the website not the generation of the content files. This are the results without regexp:
and with the complete scrollspy regexp:
As you can see the difference if marginal with such a simple regexp. |
@digitalcraftsman, |
Thanks for pointing me to the reCache. I tested it a couple of times and got on average the following result:
Under the line a good improvement of 40ms . |
Do the 400 content files you generated have matches for your regexp? |
Yes they have. The default archetype contaited content with multiple level-two headers. Therefore, each generated page triggered the regexp with multiple matches. I saw you already merged the commit in 5bfe16e. Can this pull request be closed? |
Oops, I pushed that by mistake, but with those numbers it looks solid. I was a little bit afraid that people would shoot themselves in the feet and get a slow-down. |
Should we add a note the docs that informs users about this potential bottleneck |
People that are using regexp should know what they're getting into. Let's wait and see how it unfolds. If we start getting a bunch of people confused about why their builds are slow, we can consider updating the docs. Although, I don't think it will be that much of a slowdown, anyway. The Go RE engine won't blow up in your face like all the other back-referencing engines can. |
This pull request has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
No description provided.