mirror of
https://github.com/duke-git/lancet.git
synced 2026-02-12 00:32:27 +08:00
Pre-allocate memory to reduce the number of allocations (#272)
This commit is contained in:
@@ -202,6 +202,7 @@ func (s Stream[T]) Skip(n int) Stream[T] {
|
||||
return FromSlice(source)
|
||||
}
|
||||
|
||||
source = make([]T, 0, l-n)
|
||||
for i := n; i < l; i++ {
|
||||
source = append(source, s.source[i])
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user