From 32d766d7498b4a7b1765fafa0e27bdffdc38b2a9 Mon Sep 17 00:00:00 2001 From: Gyu-Ho Lee Date: Wed, 15 Jun 2016 13:03:10 -0700 Subject: [PATCH] etcdserver: preallocate slice --- etcdserver/raft.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/etcdserver/raft.go b/etcdserver/raft.go index 1bbd32fd859..c7d0cb700d6 100644 --- a/etcdserver/raft.go +++ b/etcdserver/raft.go @@ -446,7 +446,7 @@ func getIDs(snap *raftpb.Snapshot, ents []raftpb.Entry) []uint64 { plog.Panicf("ConfChange Type should be either ConfChangeAddNode or ConfChangeRemoveNode!") } } - sids := make(types.Uint64Slice, 0) + sids := make(types.Uint64Slice, 0, len(ids)) for id := range ids { sids = append(sids, id) }