[performance] update go-structr and go-mutexes with memory usage improvements (#2909)

* update go-structr and go-mutexes with memory usage improvements

* bump to go-structr v0.8.4
This commit is contained in:
kim
2024-05-13 08:05:46 +00:00
committed by GitHub
parent 578a4e0cf5
commit c06e6fb656
26 changed files with 1409 additions and 163 deletions

View File

@ -289,9 +289,8 @@ func (c *Cache[T]) LoadOne(index *Index, key Key, load func() (T, error)) (T, er
// Load new result.
val, err = load()
// Check for ignored
// (transient) errors.
if ignore(err) {
// Check for ignored error types.
if err != nil && ignore(err) {
return val, err
}
@ -536,9 +535,10 @@ func (c *Cache[T]) Debug() map[string]any {
m["indices"] = indices
for i := range c.indices {
var n uint64
for _, list := range c.indices[i].data {
n += uint64(list.len)
}
c.indices[i].data.Iter(func(_ string, l *list) (stop bool) {
n += uint64(l.len)
return
})
indices[c.indices[i].name] = n
}
c.mutex.Unlock()