aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJosh Bleecher Snyder <josharian@gmail.com>2016-12-22 17:20:50 -0800
committerJosh Bleecher Snyder <josharian@gmail.com>2016-12-23 09:18:47 -0800
commit0e120dc4700273c23d10ef64f25663fa21b84e9b (patch)
treeba3c91550ccd9478caf7f4d63373df910196fc12
parentClean up after #636 (diff)
downloaddedo-0e120dc4700273c23d10ef64f25663fa21b84e9b.tar.gz
dedo-0e120dc4700273c23d10ef64f25663fa21b84e9b.tar.xz
Precalculate size of pending pgids in freelist.copyall
This recovers the slight alloc regression in #636.
-rw-r--r--freelist.go2
1 files changed, 1 insertions, 1 deletions
diff --git a/freelist.go b/freelist.go
index e07bf0a..de59aaa 100644
--- a/freelist.go
+++ b/freelist.go
@@ -49,7 +49,7 @@ func (f *freelist) pending_count() int {
// copyall copies into dst a list of all free ids and all pending ids in one sorted list.
// f.count returns the minimum length required for dst.
func (f *freelist) copyall(dst []pgid) {
- m := make(pgids, 0, len(f.pending)) // len(f.pending) undercounts, but it is a start
+ m := make(pgids, 0, f.pending_count())
for _, list := range f.pending {
m = append(m, list...)
}