From 712eaa4b09f952dd33ff4df04cce716e8fd26397 Mon Sep 17 00:00:00 2001 From: Blake Mizerany Date: Sat, 6 Apr 2024 15:56:20 -0700 Subject: [PATCH] x/model: add note about future changes to Name for memory efficiency --- x/model/name.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/x/model/name.go b/x/model/name.go index 96a09cc3..685574d9 100644 --- a/x/model/name.go +++ b/x/model/name.go @@ -91,6 +91,12 @@ const ( type Name struct { _ structs.Incomparable parts [NumParts]string + + // TODO(bmizerany): track offsets and hold s (raw string) here? We + // could pack the offests all into a single uint64 since the first + // parts take less bits since their max offset is less than the max + // offset of the next part. This would save a ton of bytes per Name + // and mean zero allocations for String. } // ParseName parses s into a Name. The input string must be a valid string