rollup: split rules for plain/tagged metrics (for perfomance) #162
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Try to split rules for plain/tagged metrics for reduce checks.
Benchmarks
For example:
BenchmarkSum-6 No split rules
BenchmarkSumAuto-6 Try to auto detect split rules
BenchmarkSumSeparated-6 Rules with type (all/plain/tagged_regex)
$ go test -run -benchmem -bench ^.*$ github.com/lomik/graphite-clickhouse/helper/rollup
goos: linux
goarch: amd64
pkg: github.com/lomik/graphite-clickhouse/helper/rollup
cpu: Intel(R) Core(TM) i5-9400F CPU @ 2.90GHz
BenchmarkSum-6 2933556 409.4 ns/op
BenchmarkSumAuto-6 3276351 367.9 ns/op
BenchmarkSumSeparated-6 3268159 375.0 ns/op
BenchmarkSumTagged-6 867603 1419 ns/op
BenchmarkSumTaggedAuto-6 1372341 879.9 ns/op
BenchmarkSumTaggedSeparated-6 1376115 876.3 ns/op
BenchmarkMax-6 1949413 637.4 ns/op
BenchmarkMaxAuto-6 2530356 478.0 ns/op
BenchmarkMaxSeparated-6 2512434 468.7 ns/op
BenchmarkMaxTagged-6 1000000 1073 ns/op
BenchmarkMaxTaggedAuto-6 2507865 487.6 ns/op
BenchmarkMaxTaggedSeparated-6 2528156 483.6 ns/op
BenchmarkDefault-6 2806245 429.6 ns/op
BenchmarkDefaultAuto-6 2915414 410.7 ns/op
BenchmarkDefaultSeparated-6 2931441 420.0 ns/op
BenchmarkDefaultTagged-6 1263385 952.2 ns/op
BenchmarkDefaultTaggedAuto-6 2817126 430.7 ns/op
BenchmarkDefaultTaggedSeparated-6 2752359 429.2 ns/op