etcdserver: preallocate slice

This commit is contained in:
Gyu-Ho Lee 2016-06-15 13:03:10 -07:00
parent b98fa063c8
commit 32d766d749

View File

@ -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)
}