aboutsummaryrefslogtreecommitdiffstats
path: root/pkg/codesearch/codesearch.go
diff options
context:
space:
mode:
authorDmitry Vyukov <dvyukov@google.com>2026-01-21 15:21:05 +0100
committerDmitry Vyukov <dvyukov@google.com>2026-01-22 11:23:54 +0000
commitc1de3220482e317729f83e4e7d32fc30d46ec1e7 (patch)
tree6f23f38b17aa1ac9fd0f3cacc41658165095da2e /pkg/codesearch/codesearch.go
parent084b5c918c53c4e2eeb51664f3d403095f59f25d (diff)
pkg/codesearch: reduce memory consumption more
Use uint8 enums instead of strings to store entity/reference kind. String is 16 bytes and is slower to work with.
Diffstat (limited to 'pkg/codesearch/codesearch.go')
-rw-r--r--pkg/codesearch/codesearch.go8
1 files changed, 4 insertions, 4 deletions
diff --git a/pkg/codesearch/codesearch.go b/pkg/codesearch/codesearch.go
index 051cad3c5..08018a403 100644
--- a/pkg/codesearch/codesearch.go
+++ b/pkg/codesearch/codesearch.go
@@ -206,7 +206,7 @@ func (index *Index) FileIndex(file string) ([]Entity, error) {
for _, def := range index.db.Definitions {
if def.Body.File == file {
entities = append(entities, Entity{
- Kind: def.Kind,
+ Kind: def.Kind.String(),
Name: def.Name,
})
}
@@ -243,7 +243,7 @@ func (index *Index) definitionSource(contextFile, name string, comment, includeL
}
return &EntityInfo{
File: def.Body.File,
- Kind: def.Kind,
+ Kind: def.Kind.String(),
Body: src,
}, nil
}
@@ -299,9 +299,9 @@ func (index *Index) FindReferences(contextFile, name, srcPrefix string, contextL
}
}
results = append(results, ReferenceInfo{
- ReferencingEntityKind: def.Kind,
+ ReferencingEntityKind: def.Kind.String(),
ReferencingEntityName: def.Name,
- ReferenceKind: ref.Kind,
+ ReferenceKind: ref.Kind.String(),
SourceFile: def.Body.File,
SourceLine: ref.Line,
SourceSnippet: snippet,