From c8f2982e507759139ab612b1aeebed7981fd581b Mon Sep 17 00:00:00 2001 From: Todd Gruben Date: Tue, 19 Sep 2017 08:14:34 -0500 Subject: [PATCH] micro optimization: reduce Lock calls in executor --- executor.go | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/executor.go b/executor.go index 1507c3050..d9a9b395b 100644 --- a/executor.go +++ b/executor.go @@ -92,8 +92,12 @@ func (e *Executor) Execute(ctx context.Context, index string, q *pql.Query, slic // Determine slices and inverseSlices for use in e.executeCall(). if needsSlices { // Round up the number of slices. - maxSlice := e.Holder.Index(index).MaxSlice() - maxInverseSlice := e.Holder.Index(index).MaxInverseSlice() + idx := e.Holder.Index(index) + if idx == nil { + return nil, ErrIndexNotFound + } + maxSlice := idx.MaxSlice() + maxInverseSlice := idx.MaxInverseSlice() // Generate a slices of all slices. slices = make([]uint64, maxSlice+1) @@ -108,10 +112,6 @@ func (e *Executor) Execute(ctx context.Context, index string, q *pql.Query, slic } // Fetch column label from index. - idx := e.Holder.Index(index) - if idx == nil { - return nil, ErrIndexNotFound - } columnLabel = idx.ColumnLabel() } }