Bjørn Erik Pedersen
de7137cc35
tpl/collections: Use MapRange/SetIterKey/SetIterValue for Where, Sort and Merge
...
Some relevant benchmarks:
Where with maps:
```
cpu: Apple M1 Pro
│ master.bench │ fix-mapkeys.bench │
│ sec/op │ sec/op vs base │
WhereMap-10 79.26µ ± 1% 26.58µ ± 1% -66.46% (p=0.002 n=6)
│ master.bench │ fix-mapkeys.bench │
│ B/op │ B/op vs base │
WhereMap-10 56685.0 ± 0% 111.0 ± 1% -99.80% (p=0.002 n=6)
│ master.bench │ fix-mapkeys.bench │
│ allocs/op │ allocs/op vs base │
WhereMap-10 2003.000 ± 0% 4.000 ± 0% -99.80% (p=0.002 n=6)
```
Merge:
```
│ master.bench │ fix-mapkeys.bench │
│ sec/op │ sec/op vs base │
Merge-10 3.285µ ± 0% 2.268µ ± 1% -30.96% (p=0.002 n=6)
│ master.bench │ fix-mapkeys.bench │
│ B/op │ B/op vs base │
Merge-10 3.079Ki ± 0% 1.891Ki ± 0% -38.58% (p=0.002 n=6)
│ master.bench │ fix-mapkeys.bench │
│ allocs/op │ allocs/op vs base │
Merge-10 64.00 ± 0% 26.00 ± 0% -59.38% (p=0.002 n=6)
```
Sort:
```
cpu: Apple M1 Pro
│ master.bench │ fix-mapkeys.bench │
│ sec/op │ sec/op vs base │
SortMap-10 1008.0n ± 1% 915.5n ± 0% -9.18% (p=0.002 n=6)
│ master.bench │ fix-mapkeys.bench │
│ B/op │ B/op vs base │
SortMap-10 640.0 ± 0% 512.0 ± 0% -20.00% (p=0.002 n=6)
│ master.bench │ fix-mapkeys.bench │
│ allocs/op │ allocs/op vs base │
SortMap-10 16.00 ± 0% 15.00 ± 0% -6.25% (p=0.002 n=6)
```
2025-01-13 16:24:48 +02:00
Bjørn Erik Pedersen
a795acbcd8
all: Run gofumpt -l -w .
2024-01-28 23:14:09 +01:00
Bjørn Erik Pedersen
cd1ed563a8
tpl: Improve template funcs GoDoc
2022-12-21 15:33:02 +01:00
Bjørn Erik Pedersen
f2946da9e8
Improve error messages, esp. when the server is running
...
* Add file context to minifier errors when publishing
* Misc fixes (see issues)
* Allow custom server error template in layouts/server/error.html
To get to this, this commit also cleans up and simplifies the code surrounding errors and files. This also removes the usage of `github.com/pkg/errors`, mostly because of https://github.com/pkg/errors/issues/223 -- but also because most of this is now built-in to Go.
Fixes #9852
Fixes #9857
Fixes #9863
2022-05-06 19:43:22 +02:00
Bjørn Erik Pedersen
b80853de90
all: gofmt -w -r 'interface{} -> any' .
...
Updates #9687
2022-03-17 22:03:27 +01:00
Phil Davis
04b89857e1
all: Fix minor typos
2020-12-16 12:11:32 +01:00
Cameron Moore
6d95dc9d74
tpl: Fix reflection bug in merge
...
Value.Type().Key() must only be called on map values.
Fixes #7899
2020-10-29 19:19:41 +01:00
Cameron Moore
047af7cfe5
tpl: Extend merge to accept multiple parameters
...
Fixes #7595
2020-08-28 09:54:51 +02:00
Bjørn Erik Pedersen
ccb1bf1abb
tpl/collections: Some more params merge adjustments
...
* If the end result is maps.Params, we need to lower the keys
* Also make sure to handle nested maps of different type
Update #6633
2019-12-19 20:50:30 +01:00
Bjørn Erik Pedersen
1b785a7a6d
tpl/collections: Fix merge vs Params
...
Fixes #6633
2019-12-18 21:31:34 +01:00
Bjørn Erik Pedersen
c624a77992
tpl/collections: Add Merge function
...
Merges two maps recursively and returns a new one. Merge is case-insensitive.
Fixes #5992
2019-07-15 20:47:35 +02:00