/
githubmirror
/
lazygit
Обзор
Документация
Войти
/
githubmirror
/
lazygit
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
master
pkg/utils/string_pool.go
14 строк
319 B
Stefan Haller
Store Commit.Hash by pointer (kept in a pool of hashes)
29 апр 2025, 15:57
29 апр 2025, 15:57
e27bc15
Код
Авторство
О чём код?
package utils import "sync" // A simple string pool implementation that can help reduce memory usage for // cases where the same string is used multiple times. type StringPool struct { sync.Map } func (self *StringPool) Add(s string) *string { poolEntry, _ := self.LoadOrStore(s, &s) return poolEntry.(*string) }