Iterator Perfomance Improvements - #3667
Conversation
Signed-off-by: Joe Elliott <number101010@gmail.com>
Signed-off-by: Joe Elliott <number101010@gmail.com>
Signed-off-by: Joe Elliott <number101010@gmail.com>
Signed-off-by: Joe Elliott <number101010@gmail.com>
Signed-off-by: Joe Elliott <number101010@gmail.com>
Signed-off-by: Joe Elliott <number101010@gmail.com>
Signed-off-by: Joe Elliott <number101010@gmail.com>
Signed-off-by: Joe Elliott <number101010@gmail.com>
Signed-off-by: Joe Elliott <number101010@gmail.com>
Signed-off-by: Joe Elliott <number101010@gmail.com>
Signed-off-by: Joe Elliott <number101010@gmail.com>
|
Gains due to the int64 -> int32 RowNumber conversion: Tag ValuesTraceQL SearchTraceQL Metrics |
Signed-off-by: Joe Elliott <number101010@gmail.com>
Signed-off-by: Joe Elliott <number101010@gmail.com>
Signed-off-by: Joe Elliott <number101010@gmail.com>
| return traceql.NewStaticDuration(time.Duration(e.Value.Int64())) | ||
| case columnPathSpanName: | ||
| return traceql.NewStaticString(e.Value.String()) | ||
| return traceql.NewStaticString(unsafeToString(e.Value.ByteArray())) |
There was a problem hiding this comment.
these unsafeToString calls massively reduce allocations b/c it prevents a clone on the string. The danger is in parquet-go reusing the backing buffer in a way that causes the value of the string to change.
Should we clone those strings that pass the test here:
i.e. only clone those strings that are passed up to the caller?
There was a problem hiding this comment.
You should be able to use the interner, so strings are cloned only once.
There was a problem hiding this comment.
oh! i forgot about the interner in the SyncIterator which actually does make a copy of the values returned here. so this unsafeToString call should be perfectly fine.
it's just mimicking this pattern already present in traceql search:
https://github.com/grafana/tempo/blob/main/tempodb/encoding/vparquet3/block_traceql.go#L2265
Signed-off-by: Joe Elliott <number101010@gmail.com>
Signed-off-by: Joe Elliott <number101010@gmail.com>
* steal benches Signed-off-by: Joe Elliott <number101010@gmail.com> * Gen floats, ints and bool predicates Signed-off-by: Joe Elliott <number101010@gmail.com> * remove string allocs Signed-off-by: Joe Elliott <number101010@gmail.com> * added gen to make Signed-off-by: Joe Elliott <number101010@gmail.com> * Gen strings Signed-off-by: Joe Elliott <number101010@gmail.com> * patch up vp2 and vp4 Signed-off-by: Joe Elliott <number101010@gmail.com> * remove instrumented predicate Signed-off-by: Joe Elliott <number101010@gmail.com> * int32 rns Signed-off-by: Joe Elliott <number101010@gmail.com> * skip nulls Signed-off-by: Joe Elliott <number101010@gmail.com> * vp4 unsafe string Signed-off-by: Joe Elliott <number101010@gmail.com> * revert isnull check due to impact on query range Signed-off-by: Joe Elliott <number101010@gmail.com> * remove string range cond Signed-off-by: Joe Elliott <number101010@gmail.com> * changelog Signed-off-by: Joe Elliott <number101010@gmail.com> * lint and tests Signed-off-by: Joe Elliott <number101010@gmail.com> * exclude Signed-off-by: Joe Elliott <number101010@gmail.com> * again Signed-off-by: Joe Elliott <number101010@gmail.com> * fix second line Signed-off-by: Joe Elliott <number101010@gmail.com> * fix bool pred Signed-off-by: Joe Elliott <number101010@gmail.com> * change generated file name and exclude Signed-off-by: Joe Elliott <number101010@gmail.com> * additional tests Signed-off-by: Joe Elliott <number101010@gmail.com> --------- Signed-off-by: Joe Elliott <number101010@gmail.com>
What this PR does:
A series of performance improvements that came from investigating the perf on tag value search.
GenericPredicateand included a note to not use it. There is one predicate still using this, but I would like to remove them all.GenericPredicatewas creating not inlineable function calls to do simple comparisons.unsafeToStringin the tag filters.make gen-parquet-queryto replace the usage ofGenericPredicate. This is included inmake vendor-checkso CI will confirm that the template and code do not drift.SyncIteratorInstrumentedPredicate.FloatBetweenPredicate. It was not usedTag Values Benches
TraceQL Search Benches
TraceQL Metrics Benches
Checklist
CHANGELOG.mdupdated - the order of entries should be[CHANGE],[FEATURE],[ENHANCEMENT],[BUGFIX]