зеркало из https://github.com/golang/playground.git
create slice with capacity, when capacity is known
This reduces the number of allocations made to the underlying array, while append() attempts to 'grow' the slice beyond its initial capacity
This commit is contained in:
Родитель
bd57f61ee0
Коммит
d25b90cb6a
6
play.go
6
play.go
|
@ -79,10 +79,8 @@ func (r *Recorder) Events() ([]Event, error) {
|
|||
|
||||
events := sortedMerge(evOut, evErr)
|
||||
|
||||
var (
|
||||
out []Event
|
||||
now = epoch
|
||||
)
|
||||
now := epoch
|
||||
out := make([]Event, 0, len(events))
|
||||
|
||||
for _, e := range events {
|
||||
delay := e.time.Sub(now)
|
||||
|
|
Загрузка…
Ссылка в новой задаче