optimize allocation
This commit is contained in:
parent
e7e6d5cecb
commit
4fc389edcb
1 changed files with 4 additions and 2 deletions
|
@ -74,9 +74,11 @@ func (lib *Library) Remove(path string) {
|
|||
func (lib *Library) Playlist() Playlist {
|
||||
lib.mu.RLock()
|
||||
defer lib.mu.RUnlock()
|
||||
pl := make(Playlist, 0)
|
||||
pl := make(Playlist, len(lib.Videos))
|
||||
i := 0
|
||||
for _, v := range lib.Videos {
|
||||
pl = append(pl, v)
|
||||
pl[i] = v
|
||||
i++
|
||||
}
|
||||
sort.Sort(pl)
|
||||
return pl
|
||||
|
|
Loading…
Reference in a new issue