mirror of
https://github.com/navidrome/navidrome.git
synced 2025-04-03 20:47:35 +03:00
refactor: reduce GC pressure by pre-allocating slices
Signed-off-by: Deluan <deluan@navidrome.org>
This commit is contained in:
parent
3982ba7258
commit
d229ff39e5
10 changed files with 325 additions and 262 deletions
|
@ -140,11 +140,12 @@ func (r sqlRepository) buildSortOrder(sort, order string) string {
|
|||
reverseOrder = "desc"
|
||||
}
|
||||
|
||||
var newSort []string
|
||||
parts := strings.FieldsFunc(sort, splitFunc(','))
|
||||
newSort := make([]string, 0, len(parts))
|
||||
for _, p := range parts {
|
||||
f := strings.FieldsFunc(p, splitFunc(' '))
|
||||
newField := []string{f[0]}
|
||||
newField := make([]string, 1, len(f))
|
||||
newField[0] = f[0]
|
||||
if len(f) == 1 {
|
||||
newField = append(newField, order)
|
||||
} else {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue