mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
Performance: Add preallocation for some slices (#59593)
This commit is contained in:
@@ -118,7 +118,7 @@ func (out *RemoteWriteFrameOutput) sample(timeSeries []prompb.TimeSeries) []prom
|
||||
sample.Samples = append(sample.Samples, filteredSamples...)
|
||||
samples[name] = sample
|
||||
}
|
||||
var toReturn []prompb.TimeSeries
|
||||
toReturn := make([]prompb.TimeSeries, 0, len(samples))
|
||||
for _, ts := range samples {
|
||||
toReturn = append(toReturn, ts)
|
||||
}
|
||||
|
||||
@@ -309,7 +309,7 @@ func (f *StorageRuleBuilder) BuildRules(ctx context.Context, orgID int64) ([]*Li
|
||||
return nil, err
|
||||
}
|
||||
|
||||
var rules []*LiveChannelRule
|
||||
rules := make([]*LiveChannelRule, 0, len(channelRules))
|
||||
|
||||
for _, ruleConfig := range channelRules {
|
||||
rule := &LiveChannelRule{
|
||||
|
||||
Reference in New Issue
Block a user