1
0
Fork 0
hugo/tpl/collections
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
..
append.go tpl: Improve template funcs GoDoc 2022-12-21 15:33:02 +01:00
append_test.go Create a struct with all of Hugo's config options 2023-05-16 18:01:29 +02:00
apply.go all: Rework page store, add a dynacache, improve partial rebuilds, and some general spring cleaning 2024-01-27 16:28:14 +01:00
apply_test.go all: Rework page store, add a dynacache, improve partial rebuilds, and some general spring cleaning 2024-01-27 16:28:14 +01:00
collections.go tpl/collections: Allow querify to accept a map argument 2024-12-13 13:30:55 +01:00
collections_integration_test.go Fix union, complement, symdiff, and intersect for transient resources 2024-12-22 19:25:03 +01:00
collections_test.go tpl/collections: Allow querify to accept a map argument 2024-12-13 13:30:55 +01:00
complement.go tpl: Improve template funcs GoDoc 2022-12-21 15:33:02 +01:00
complement_test.go Create a struct with all of Hugo's config options 2023-05-16 18:01:29 +02:00
index.go Create a struct with all of Hugo's config options 2023-05-16 18:01:29 +02:00
index_test.go Create a struct with all of Hugo's config options 2023-05-16 18:01:29 +02:00
init.go Remove deprecations <= v0.122.0 (note) 2024-11-16 20:32:43 +01:00
merge.go tpl/collections: Use MapRange/SetIterKey/SetIterValue for Where, Sort and Merge 2025-01-13 16:24:48 +02:00
merge_test.go tpl/collections: Add Merge benchmark 2025-01-13 10:32:41 +02:00
querify.go tpl/collections: Allow querify to accept a map argument 2024-12-13 13:30:55 +01:00
querify_test.go tpl/collections: Allow querify to accept a map argument 2024-12-13 13:30:55 +01:00
reflect_helpers.go Fix union, complement, symdiff, and intersect for transient resources 2024-12-22 19:25:03 +01:00
sort.go tpl/collections: Use MapRange/SetIterKey/SetIterValue for Where, Sort and Merge 2025-01-13 16:24:48 +02:00
sort_test.go tpl/collections: Add BenchmarkSortMap 2025-01-13 10:38:12 +02:00
symdiff.go Improve error messages, esp. when the server is running 2022-05-06 19:43:22 +02:00
symdiff_test.go Create a struct with all of Hugo's config options 2023-05-16 18:01:29 +02:00
where.go tpl/collections: Use MapRange/SetIterKey/SetIterValue for Where, Sort and Merge 2025-01-13 16:24:48 +02:00
where_test.go tpl/collections: Add BenchmarkWhereMap 2025-01-13 12:57:48 +02:00