mirror of
https://github.com/prometheus/prometheus.git
synced 2026-03-23 19:04:15 -04:00
Replace map[uint64]struct{} inner maps in the resource attribute
inverted index with sorted []uint64 slices using copy-on-write
semantics. This reduces memory ~4x (8 bytes/entry vs ~50 bytes/entry
for hash map overhead) and eliminates snapshot copies on read.
sortedInsert/sortedRemove create new slices on mutation, so readers
holding old slices are safe from concurrent changes. LookupResourceAttr
returns the live slice directly (zero-copy).
The layered reader uses two-pointer sorted merge for union operations.
The web API uses two-pointer sorted intersection for filter intersection.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Signed-off-by: Arve Knudsen <arve.knudsen@gmail.com>
|
||
|---|---|---|
| .. | ||
| testdata | ||
| api.go | ||
| api_scenarios_test.go | ||
| api_test.go | ||
| codec.go | ||
| codec_test.go | ||
| errors_test.go | ||
| json_codec.go | ||
| json_codec_test.go | ||
| openapi.go | ||
| openapi_coverage_test.go | ||
| openapi_examples.go | ||
| openapi_golden_test.go | ||
| openapi_helpers.go | ||
| openapi_paths.go | ||
| openapi_schemas.go | ||
| openapi_test.go | ||
| test_helpers.go | ||
| translate_ast.go | ||