Bjørn Erik Pedersen
2babd6404e
identity: Use xxHash in hashstructure (note)
...
```
name old time/op new time/op delta
HashString/n28-10 133ns ± 9% 107ns ±10% -19.58% (p=0.029 n=4+4)
HashString/n112-10 243ns ± 5% 121ns ± 4% -50.08% (p=0.029 n=4+4)
HashString/n448-10 698ns ± 3% 174ns ± 5% -75.02% (p=0.029 n=4+4)
HashString/n1792-10 2.58µs ± 4% 0.38µs ± 4% -85.11% (p=0.029 n=4+4)
HashString/n7168-10 10.0µs ± 3% 1.3µs ± 4% -86.91% (p=0.029 n=4+4)
name old alloc/op new alloc/op delta
HashString/n28-10 80.0B ± 0% 72.0B ± 0% -10.00% (p=0.029 n=4+4)
HashString/n112-10 160B ± 0% 152B ± 0% -5.00% (p=0.029 n=4+4)
HashString/n448-10 496B ± 0% 488B ± 0% -1.61% (p=0.029 n=4+4)
HashString/n1792-10 1.84kB ± 0% 1.83kB ± 0% -0.43% (p=0.029 n=4+4)
HashString/n7168-10 8.24kB ± 0% 8.23kB ± 0% -0.06% (p=0.029 n=4+4)
name old allocs/op new allocs/op delta
HashString/n28-10 4.00 ± 0% 3.00 ± 0% -25.00% (p=0.029 n=4+4)
HashString/n112-10 4.00 ± 0% 3.00 ± 0% -25.00% (p=0.029 n=4+4)
HashString/n448-10 4.00 ± 0% 3.00 ± 0% -25.00% (p=0.029 n=4+4)
HashString/n1792-10 4.00 ± 0% 3.00 ± 0% -25.00% (p=0.029 n=4+4)
HashString/n7168-10 4.00 ± 0% 3.00 ± 0% -25.00% (p=0.029 n=4+4)
```
2024-07-31 16:44:06 +02:00
Bjørn Erik Pedersen
78db8aebca
identity: Upgrade to github.com/mitchellh/hashstructure/v2 v2.0.2
...
```
name old time/op new time/op delta
HashString/n28-10 131ns ± 7% 133ns ±19% ~ (p=0.343 n=4+4)
HashString/n112-10 237ns ± 5% 241ns ± 3% ~ (p=0.229 n=4+4)
HashString/n448-10 688ns ± 3% 687ns ± 1% ~ (p=0.886 n=4+4)
HashString/n1792-10 2.51µs ± 3% 2.56µs ± 3% ~ (p=0.200 n=4+4)
HashString/n7168-10 10.1µs ± 2% 10.0µs ± 4% ~ (p=0.686 n=4+4)
name old alloc/op new alloc/op delta
HashString/n28-10 80.0B ± 0% 80.0B ± 0% ~ (all equal)
HashString/n112-10 160B ± 0% 160B ± 0% ~ (all equal)
HashString/n448-10 496B ± 0% 496B ± 0% ~ (all equal)
HashString/n1792-10 1.84kB ± 0% 1.84kB ± 0% ~ (all equal)
HashString/n7168-10 8.24kB ± 0% 8.24kB ± 0% ~ (all equal)
name old allocs/op new allocs/op delta
HashString/n28-10 4.00 ± 0% 4.00 ± 0% ~ (all equal)
HashString/n112-10 4.00 ± 0% 4.00 ± 0% ~ (all equal)
HashString/n448-10 4.00 ± 0% 4.00 ± 0% ~ (all equal)
HashString/n1792-10 4.00 ± 0% 4.00 ± 0% ~ (all equal)
HashString/n7168-10 4.00 ± 0% 4.00 ± 0% ~ (all equal)
```
Closes #11644
2024-07-31 16:44:06 +02:00
Bjørn Erik Pedersen
447108fed2
Add a HTTP cache for remote resources.
...
Fixes #12502
Closes #11891
2024-06-04 16:07:39 +02:00
Bjørn Erik Pedersen
a795acbcd8
all: Run gofumpt -l -w .
2024-01-28 23:14:09 +01:00
Bjørn Erik Pedersen
b5d485060f
Fix order when reading custom headers in resources.GetRemote
...
Fixes #10616
2023-01-16 14:44:15 +01:00
Bjørn Erik Pedersen
2dbdf38a54
resources: Add key
to reources.GetRemote options map
...
If set, `key` will be used as the only cache key element for the resource.
The default behaviour is to calculate the key based on the URL and all the options.
This means that you can now do:
```
{{ $cacheKey := print $url (now.Format "2006-01-02") }}
{{ $resource := resource.GetRemote $url (dict "key" $cacheKey) }}
```
Fixes #9755
2022-04-13 09:18:17 +02:00
Bjørn Erik Pedersen
b80853de90
all: gofmt -w -r 'interface{} -> any' .
...
Updates #9687
2022-03-17 22:03:27 +01:00
Bjørn Erik Pedersen
22ef5da20d
Add resources.GetRemote
...
In Hugo 0.89 we added remote support to `resources.Get`.
In hindsight that was not a great idea, as a poll from many Hugo users showed. See Issue #9285 for more details.
After this commit `resources.Get` only supports local resource lookups. If you want to support both, you need to use a construct similar to:
Also improve some option case handling.
```
{{ resource := "" }}
{{ if (urls.Parse $url).IsAbs }}
{{ $resource = resources.GetRemote $url }}
{{ else }}
{{ $resource = resources.Get $url }}
{{ end }}
```
Fixes #9285
Fixes #9296
2021-12-17 09:33:51 +01:00