]> git.maquefel.me Git - brevno-suite/hugo/commit
helpers: Avoid url.Parse in RelURL and AbsURL if we can
authorBjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com>
Mon, 12 Jun 2023 13:08:40 +0000 (15:08 +0200)
committerBjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com>
Mon, 12 Jun 2023 14:15:59 +0000 (16:15 +0200)
commited7e250068a495469a0f8e0859c7f667330b1013
treefb6920972f69c5e2eac1be5b9b115a26553316a3
parent6a09e7f28e0d779aed504379e8eb486c9da9040a
helpers: Avoid url.Parse in RelURL and AbsURL if we can

```
RelURL-10            159ns ± 5%      18ns ± 4%   -88.89%  (p=0.029 n=4+4)
AbsURL/relurl-10     532ns ± 0%     537ns ± 0%    +1.09%  (p=0.029 n=4+4)
AbsURL/absurl-10     142ns ± 0%       4ns ± 3%   -96.91%  (p=0.029 n=4+4)

name              old alloc/op   new alloc/op   delta
RelURL-10             144B ± 0%        0B       -100.00%  (p=0.029 n=4+4)
AbsURL/relurl-10      544B ± 0%      544B ± 0%      ~     (all equal)
AbsURL/absurl-10      144B ± 0%        0B       -100.00%  (p=0.029 n=4+4)

name              old allocs/op  new allocs/op  delta
RelURL-10             1.00 ± 0%      0.00       -100.00%  (p=0.029 n=4+4)
AbsURL/relurl-10      10.0 ± 0%      10.0 ± 0%      ~     (all equal)
AbsURL/absurl-10      1.00 ± 0%      0.00       -100.00%  (p=0.029 n=4+4)
```
helpers/url.go