diff options
author | bep <[email protected]> | 2015-02-16 10:48:15 +0100 |
---|---|---|
committer | spf13 <[email protected]> | 2015-02-16 08:24:42 -0500 |
commit | f1fec88c308631ab9618b9a2b6dba9c714b087c1 (patch) | |
tree | 1cdae7bc240c695f520bda4991810a80405498d6 /.gitignore | |
parent | 27c03a6dd0bd003c77cdd4ded19ca8c3033e6476 (diff) | |
download | hugo-f1fec88c308631ab9618b9a2b6dba9c714b087c1.tar.gz hugo-f1fec88c308631ab9618b9a2b6dba9c714b087c1.zip |
Improve abs url replacement speed
This commit replaces the multuple `bytes.Containts` and `bytes.Replace` with a custom replacer that does one pass through the document and exploits the fact that there are two common prefixes we search for, `src=` and `href=`.
This is both faster and consumes less memory. There may be even better algos to use here, but we must leave some room for improvements for future versions.
This should also make it possible to solve #816.
```
benchmark old ns/op new ns/op delta
BenchmarkAbsUrl 25795 22597 -12.40%
BenchmarkXmlAbsUrl 17187 11166 -35.03%
benchmark old allocs new allocs delta
BenchmarkAbsUrl 60 33 -45.00%
BenchmarkXmlAbsUrl 30 16 -46.67%
benchmark old bytes new bytes delta
BenchmarkAbsUrl 5844 4167 -28.70%
BenchmarkXmlAbsUrl 3754 2069 -44.89%
```
Fixes #894
Diffstat (limited to '.gitignore')
-rw-r--r-- | .gitignore | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/.gitignore b/.gitignore index 3ea8aedd6..41162a757 100644 --- a/.gitignore +++ b/.gitignore @@ -2,6 +2,8 @@ hugo docs/public*
hugo.exe
*.test
+*.prof
+nohup.out
cover.out
*.swp
*.swo
|