From 1225ed591bba3b104e09f5945979f14683d57394 Mon Sep 17 00:00:00 2001 From: Aliaksandr Valialkin Date: Tue, 7 May 2024 17:05:20 +0200 Subject: [PATCH] wip --- lib/logstorage/pipe_sort.go | 5 +++++ lib/logstorage/storage_search.go | 4 ++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/lib/logstorage/pipe_sort.go b/lib/logstorage/pipe_sort.go index 607a3d91d..c3e974ba7 100644 --- a/lib/logstorage/pipe_sort.go +++ b/lib/logstorage/pipe_sort.go @@ -534,6 +534,11 @@ func sortBlockLess(shardA *pipeSortProcessorShard, rowIdxA int, shardB *pipeSort cB := &bB.byColumns[idx] bf := byFields[idx] + if cA.c.isConst && cB.c.isConst { + // Fast path - compare const values + return cA.c.encodedValues[0] < cB.c.encodedValues[0] + } + if cA.c.isTime && cB.c.isTime { // Fast path - sort by _time tA := bA.br.timestamps[rrA.rowIdx] diff --git a/lib/logstorage/storage_search.go b/lib/logstorage/storage_search.go index 3615be02a..fcc82b6dd 100644 --- a/lib/logstorage/storage_search.go +++ b/lib/logstorage/storage_search.go @@ -189,8 +189,8 @@ func getEmptyStrings(rowsCount int) []string { } values := *p if n := rowsCount - cap(values); n > 0 { - values = append(values[:cap(values)], make([]string, n)...) - emptyStrings.Store(&values) + valuesNew := append(values[:cap(values)], make([]string, n)...) + emptyStrings.Store(&valuesNew) } return values[:rowsCount] }