perf(storage): remeove erroneous variable
This commit removes an unused slice that was being built up. Comparting to the base-line performance yields a slight improvement when deleting from the cache. name old time/op new time/op delta Engine_DeletePrefixRange_Cache/exists-24 268ms ± 5% 262ms ± 6% ~ (p=0.218 n=10+10) Engine_DeletePrefixRange_Cache/not_exists-24 265ms ± 5% 266ms ± 4% ~ (p=0.965 n=10+8) name old alloc/op new alloc/op delta Engine_DeletePrefixRange_Cache/exists-24 64.1MB ± 0% 62.7MB ± 0% -2.16% (p=0.000 n=9+9) Engine_DeletePrefixRange_Cache/not_exists-24 59.2MB ± 0% 59.2MB ± 0% ~ (p=0.505 n=8+8) name old allocs/op new allocs/op delta Engine_DeletePrefixRange_Cache/exists-24 711k ± 0% 711k ± 0% -0.00% (p=0.000 n=9+9) Engine_DeletePrefixRange_Cache/not_exists-24 700k ± 0% 700k ± 0% ~ (p=0.687 n=8+8) Raw benchmarks using a 24T / 32GB / NVME machine: goos: linux goarch: amd64 pkg: github.com/influxdata/influxdb/tsdb/tsm1 BenchmarkEngine_DeletePrefixRange_Cache/exists-24 30 267664312 ns/op 62689106 B/op 711400 allocs/op BenchmarkEngine_DeletePrefixRange_Cache/exists-24 30 255017152 ns/op 62688809 B/op 711398 allocs/op BenchmarkEngine_DeletePrefixRange_Cache/exists-24 30 258136039 ns/op 62689626 B/op 711404 allocs/op BenchmarkEngine_DeletePrefixRange_Cache/exists-24 30 273982453 ns/op 62688325 B/op 711395 allocs/op BenchmarkEngine_DeletePrefixRange_Cache/exists-24 30 252670795 ns/op 62688704 B/op 711397 allocs/op BenchmarkEngine_DeletePrefixRange_Cache/exists-24 30 277700985 ns/op 61801204 B/op 702520 allocs/op BenchmarkEngine_DeletePrefixRange_Cache/exists-24 30 272353886 ns/op 62688767 B/op 711403 allocs/op BenchmarkEngine_DeletePrefixRange_Cache/exists-24 30 258717468 ns/op 62689461 B/op 711408 allocs/op BenchmarkEngine_DeletePrefixRange_Cache/exists-24 30 252909070 ns/op 62688949 B/op 711404 allocs/op BenchmarkEngine_DeletePrefixRange_Cache/exists-24 30 255436837 ns/op 62689712 B/op 711409 allocs/op BenchmarkEngine_DeletePrefixRange_Cache/not_exists-24 30 241173429 ns/op 59202122 B/op 700036 allocs/op BenchmarkEngine_DeletePrefixRange_Cache/not_exists-24 30 247961098 ns/op 60507541 B/op 714102 allocs/op BenchmarkEngine_DeletePrefixRange_Cache/not_exists-24 20 263380230 ns/op 59202750 B/op 700044 allocs/op BenchmarkEngine_DeletePrefixRange_Cache/not_exists-24 30 266035285 ns/op 59202758 B/op 700043 allocs/op BenchmarkEngine_DeletePrefixRange_Cache/not_exists-24 30 266512878 ns/op 59202759 B/op 700044 allocs/op BenchmarkEngine_DeletePrefixRange_Cache/not_exists-24 30 262065769 ns/op 59202726 B/op 700043 allocs/op BenchmarkEngine_DeletePrefixRange_Cache/not_exists-24 30 270485538 ns/op 59202733 B/op 700043 allocs/op BenchmarkEngine_DeletePrefixRange_Cache/not_exists-24 30 263355678 ns/op 62562757 B/op 727794 allocs/op BenchmarkEngine_DeletePrefixRange_Cache/not_exists-24 30 260440337 ns/op 59203324 B/op 700050 allocs/op BenchmarkEngine_DeletePrefixRange_Cache/not_exists-24 30 276122362 ns/op 59203316 B/op 700050 allocs/op PASS ok github.com/influxdata/influxdb/tsdb/tsm1 259.435spull/14892/head
parent
f2d6c93e65
commit
15ade8c162
|
@ -8,7 +8,6 @@ import (
|
|||
|
||||
"github.com/influxdata/influxdb/kit/tracing"
|
||||
"github.com/influxdata/influxdb/models"
|
||||
"github.com/influxdata/influxdb/pkg/bytesutil"
|
||||
"github.com/influxdata/influxdb/tsdb"
|
||||
"github.com/influxdata/influxql"
|
||||
)
|
||||
|
@ -88,8 +87,6 @@ func (e *Engine) DeletePrefixRange(rootCtx context.Context, name []byte, min, ma
|
|||
return err
|
||||
}
|
||||
|
||||
var deleteKeys [][]byte
|
||||
|
||||
// ApplySerialEntryFn cannot return an error in this invocation.
|
||||
_ = e.Cache.ApplyEntryFn(func(k []byte, _ *entry) error {
|
||||
// TODO(edd): tracing this deep down is currently speculative, so I have
|
||||
|
@ -104,8 +101,6 @@ func (e *Engine) DeletePrefixRange(rootCtx context.Context, name []byte, min, ma
|
|||
return nil
|
||||
}
|
||||
|
||||
deleteKeys = append(deleteKeys, k)
|
||||
|
||||
// we have to double check every key in the cache because maybe
|
||||
// it exists in the index but not yet on disk.
|
||||
possiblyDead.keys[string(k)] = struct{}{}
|
||||
|
@ -113,9 +108,7 @@ func (e *Engine) DeletePrefixRange(rootCtx context.Context, name []byte, min, ma
|
|||
return nil
|
||||
})
|
||||
|
||||
// Sort the series keys because ApplyEntryFn iterates over the keys randomly.
|
||||
sortSpan, _ := tracing.StartSpanFromContextWithOperationName(rootCtx, "Cache sort keys")
|
||||
bytesutil.Sort(deleteKeys)
|
||||
sortSpan.Finish()
|
||||
|
||||
// Delete from the cache.
|
||||
|
|
Loading…
Reference in New Issue