summaryrefslogtreecommitdiff
path: root/vendor/codeberg.org/gruf/go-structr/queue.go
diff options
context:
space:
mode:
authorLibravatar kim <89579420+NyaaaWhatsUpDoc@users.noreply.github.com>2024-05-06 19:44:22 +0000
committerLibravatar GitHub <noreply@github.com>2024-05-06 19:44:22 +0000
commit3554991444c979c8c4fabc62383d1a032ae3e5fe (patch)
tree63cbd222bff33ab603ac024ba02c1a6d8ea454c7 /vendor/codeberg.org/gruf/go-structr/queue.go
parentfeature: filters v2 server-side warning/hiding (#2793) (diff)
downloadgotosocial-3554991444c979c8c4fabc62383d1a032ae3e5fe.tar.xz
update go-structr -> v0.8.2 which includes some minor memory usage improvements (#2904)
Diffstat (limited to 'vendor/codeberg.org/gruf/go-structr/queue.go')
-rw-r--r--vendor/codeberg.org/gruf/go-structr/queue.go6
1 files changed, 6 insertions, 0 deletions
diff --git a/vendor/codeberg.org/gruf/go-structr/queue.go b/vendor/codeberg.org/gruf/go-structr/queue.go
index 91092790a..d7c21daaa 100644
--- a/vendor/codeberg.org/gruf/go-structr/queue.go
+++ b/vendor/codeberg.org/gruf/go-structr/queue.go
@@ -276,6 +276,12 @@ func (q *Queue[T]) pop_n(n int, next func() *list_elem) []T {
func (q *Queue[T]) index(value T) *indexed_item {
item := new_indexed_item()
+ if cap(item.indexed) < len(q.indices) {
+
+ // Preallocate item indices slice to prevent Go auto
+ // allocating overlying large slices we don't need.
+ item.indexed = make([]*index_entry, 0, len(q.indices))
+ }
// Set item value.
item.data = value