Slice expression simplifications.

This commit is contained in:
Julius Volz 2013-05-07 13:22:29 +02:00
parent 4872ec7577
commit 05afa970d2
2 changed files with 7 additions and 7 deletions

View File

@ -381,7 +381,7 @@ func optimizeForward(pending ops) (out ops) {
tail ops tail ops
) )
pending = pending[1:len(pending)] pending = pending[1:]
switch t := head.(type) { switch t := head.(type) {
case *getValuesAtTimeOp: case *getValuesAtTimeOp:
@ -434,7 +434,7 @@ func optimizeForward(pending ops) (out ops) {
switch next := peekOperation.(type) { switch next := peekOperation.(type) {
// All values at a specific time may be elided into the range query. // All values at a specific time may be elided into the range query.
case *getValuesAtTimeOp: case *getValuesAtTimeOp:
pending = pending[1:len(pending)] pending = pending[1:]
continue continue
case *getValuesAlongRangeOp: case *getValuesAlongRangeOp:
// Range queries should be concatenated if they overlap. // Range queries should be concatenated if they overlap.
@ -443,10 +443,10 @@ func optimizeForward(pending ops) (out ops) {
return optimizeForward(pending) return optimizeForward(pending)
} else { } else {
pending = pending[1:len(pending)] pending = pending[1:]
} }
case *getValuesAtIntervalOp: case *getValuesAtIntervalOp:
pending = pending[1:len(pending)] pending = pending[1:]
if next.GreedierThan(t) { if next.GreedierThan(t) {
var ( var (
@ -488,7 +488,7 @@ func selectQueriesForTime(time time.Time, queries ops) (out ops) {
} }
out = append(out, queries[0]) out = append(out, queries[0])
tail := selectQueriesForTime(time, queries[1:len(queries)]) tail := selectQueriesForTime(time, queries[1:])
return append(out, tail...) return append(out, tail...)
} }
@ -682,7 +682,7 @@ func optimizeTimeGroups(pending ops) (out ops) {
) )
out = optimizeTimeGroup(groupedQueries) out = optimizeTimeGroup(groupedQueries)
pending = pending[len(groupedQueries):len(pending)] pending = pending[len(groupedQueries):]
tail := optimizeTimeGroups(pending) tail := optimizeTimeGroups(pending)

View File

@ -394,7 +394,7 @@ func (t TieredStorage) renderView(viewJob viewJob) {
// If we aimed past the newest value on disk, combine it with the next value from memory. // If we aimed past the newest value on disk, combine it with the next value from memory.
if len(memValues) > 0 && diskValues.LastTimeBefore(targetTime) { if len(memValues) > 0 && diskValues.LastTimeBefore(targetTime) {
latestDiskValue := diskValues[len(diskValues)-1 : len(diskValues)] latestDiskValue := diskValues[len(diskValues)-1:]
chunk = append(latestDiskValue, memValues...) chunk = append(latestDiskValue, memValues...)
} else { } else {
chunk = diskValues chunk = diskValues