Skip to content

Commit 2ce27ed

Browse files
authored
Write performance optimization (2.5x) (#428)
Disable performance metrics (~15% gain) Perform sort only if metrics were out of order(100% gain)
1 parent 2e6a797 commit 2ce27ed

File tree

2 files changed

+2
-5
lines changed

2 files changed

+2
-5
lines changed

Diff for: internal/pkg/performance/metrics.go

+1-4
Original file line numberDiff line numberDiff line change
@@ -190,8 +190,5 @@ func (mr *MetricReporter) isEnabled() bool {
190190
}
191191

192192
func (mr *MetricReporter) isRunning() bool {
193-
mr.lock.Lock()
194-
defer mr.lock.Unlock()
195-
196-
return mr.running
193+
return false
197194
}

Diff for: pkg/appender/store.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -232,7 +232,7 @@ func (cs *chunkStore) Append(t int64, v interface{}) {
232232

233233
cs.pending = append(cs.pending, pendingData{t: t, v: v})
234234
// If the new time is older than previous times, sort the list
235-
if len(cs.pending) > 1 && cs.pending[len(cs.pending)-2].t < t {
235+
if len(cs.pending) > 1 && cs.pending[len(cs.pending)-2].t > t {
236236
sort.Sort(cs.pending)
237237
}
238238
}

0 commit comments

Comments
 (0)