mirror of
https://github.com/gohugoio/hugo.git
synced 2025-08-21 21:35:28 +02:00
hugolib: Rewrite replaceDivider to reduce memory allocation
```bash name old time/op new time/op delta ReplaceDivider-4 9.76µs ±105% 7.96µs ±24% ~ (p=0.690 n=5+5) name old alloc/op new alloc/op delta ReplaceDivider-4 3.46kB ± 0% 1.54kB ± 0% -55.56% (p=0.008 n=5+5) name old allocs/op new allocs/op delta ReplaceDivider-4 6.00 ± 0% 1.00 ± 0% -83.33% (p=0.008 n=5+5) ```
This commit is contained in:
@@ -1107,7 +1107,7 @@ func TestReplaceDivider(t *testing.T) {
|
||||
expectedTruncated bool
|
||||
}{
|
||||
{"none", "a", "b", "none", false},
|
||||
{"summary divider content", "divider", "HUGO", "summary HUGO content", true},
|
||||
{"summary <!--more--> content", "<!--more-->", "HUGO", "summary HUGO content", true},
|
||||
{"summary\n\ndivider", "divider", "HUGO", "summary\n\nHUGO", false},
|
||||
{"summary\n\ndivider\n\r", "divider", "HUGO", "summary\n\nHUGO\n\r", false},
|
||||
}
|
||||
|
Reference in New Issue
Block a user