frostfs-sdk-go/netmap
Evgenii Stratonikov d282cd094f
All checks were successful
DCO / DCO (pull_request) Successful in 23s
Code generation / Generate proto (pull_request) Successful in 1m27s
Tests and linters / Tests (pull_request) Successful in 1m27s
Tests and linters / Lint (pull_request) Successful in 2m35s
[#355] netmap: Cache price and capacity attributes
They are used by HRW sorting and it makes sense to store them separately
instead of iterating over all attributes each time we need them.
It also simplifies code: we already parse them in NodeInfo.readFromV2(),
so just save the result.

```
goos: linux
goarch: amd64
pkg: git.frostfs.info/TrueCloudLab/frostfs-sdk-go/netmap
cpu: 11th Gen Intel(R) Core(TM) i5-1135G7 @ 2.40GHz
                                                              │     old     │                 new                 │
                                                              │   sec/op    │   sec/op     vs base                │
Netmap_ContainerNodes/REP_2-8                                   5.923µ ± 0%   5.209µ ± 1%  -12.05% (p=0.000 n=10)
Netmap_ContainerNodes/REP_2_IN_X_CBF_2_SELECT_2_FROM_*_AS_X-8   5.931µ ± 7%   5.088µ ± 1%  -14.22% (p=0.000 n=10)
geomean                                                         5.927µ        5.148µ       -13.14%

                                                              │     old      │                 new                 │
                                                              │     B/op     │     B/op      vs base               │
Netmap_ContainerNodes/REP_2-8                                   7.609Ki ± 0%   8.172Ki ± 0%  +7.39% (p=0.000 n=10)
Netmap_ContainerNodes/REP_2_IN_X_CBF_2_SELECT_2_FROM_*_AS_X-8   7.031Ki ± 0%   7.469Ki ± 0%  +6.22% (p=0.000 n=10)
geomean                                                         7.315Ki        7.812Ki       +6.81%

                                                              │    old     │                 new                 │
                                                              │ allocs/op  │ allocs/op   vs base                 │
Netmap_ContainerNodes/REP_2-8                                   77.00 ± 0%   77.00 ± 0%       ~ (p=1.000 n=10) ¹
Netmap_ContainerNodes/REP_2_IN_X_CBF_2_SELECT_2_FROM_*_AS_X-8   77.00 ± 0%   77.00 ± 0%       ~ (p=1.000 n=10) ¹
geomean                                                         77.00        77.00       +0.00%
¹ all samples are equal
```

Signed-off-by: Evgenii Stratonikov <e.stratonikov@yadro.com>
2025-04-07 17:47:08 +03:00
..
parser [#269] netmap: Regenerate policy parser 2024-09-20 11:09:16 +00:00
test [#161] *: Do not use math/rand.Read() 2023-09-08 17:17:02 +03:00
yml_tests [#306] netmap: Allow to select empty set of nodes 2024-12-05 15:33:29 +03:00
aggregator.go [#355] netmap: Cache price and capacity attributes 2025-04-07 17:47:08 +03:00
aggregator_test.go [#88] netmap: fix min aggregator bug, add tests 2023-10-03 07:05:03 +00:00
bench_test.go [#265] go.mod: Use range over int 2024-09-04 12:37:46 +03:00
context.go [#355] netmap: Cache price and capacity attributes 2025-04-07 17:47:08 +03:00
doc.go [#276] Merge repo with frostfs-api-go 2024-10-22 14:05:12 +00:00
filter.go [#355] netmap: Cache price and capacity attributes 2025-04-07 17:47:08 +03:00
filter_test.go [#276] Merge repo with frostfs-api-go 2024-10-22 14:05:12 +00:00
helper_test.go [#276] Merge repo with frostfs-api-go 2024-10-22 14:05:12 +00:00
netmap.go [#357] netmap: Provide slice to append to in flattenNodes() 2025-04-05 11:36:33 +03:00
netmap_test.go [#344] netmap: Add method Clone 2025-03-07 18:02:02 +03:00
network_info.go [#354] api/netmap: Return a slice of parameters directly 2025-04-07 14:39:47 +00:00
network_info_decode_test.go [#240] netmap: Support HomomorphicHashingDisabled network config 2022-07-05 15:37:49 +03:00
network_info_test.go [#354] api/netmap: Return a slice of parameters directly 2025-04-07 14:39:47 +00:00
node_info.go [#355] netmap: Cache price and capacity attributes 2025-04-07 17:47:08 +03:00
node_info_test.go [#356] netmap: Check for attribute duplicates in NodeInfo.readFromV2() 2025-04-07 09:10:32 +00:00
policy.go [#276] Merge repo with frostfs-api-go 2024-10-22 14:05:12 +00:00
policy_decode_test.go [#216] netmap: Add policy decode fuzz test 2024-05-07 11:10:37 +00:00
policy_fuzz.go [#216] netmap: Add policy decode fuzz test 2024-05-07 11:10:37 +00:00
policy_fuzz_test.go [#216] netmap: Add policy decode fuzz test 2024-05-07 11:10:37 +00:00
policy_test.go [#269] netmap: Add tests for non-ascii attributes in SELECT IN 2024-09-20 11:09:16 +00:00
selector.go [#306] netmap: Allow to select empty set of nodes 2024-12-05 15:33:29 +03:00
selector_test.go [#357] netmap: Provide slice to append to in flattenNodes() 2025-04-05 11:36:33 +03:00
Tests.md [#23] pre-commit: Add initial configuration 2023-03-09 22:52:51 +03:00
yml_test.go [#306] netmap: Allow to select empty set of nodes 2024-12-05 15:33:29 +03:00
yml_unmarshal.go [#276] Merge repo with frostfs-api-go 2024-10-22 14:05:12 +00:00