diff --git a/pkg/logql/log/base b/pkg/logql/log/base new file mode 100644 index 000000000000..6a3c59eeed9c --- /dev/null +++ b/pkg/logql/log/base @@ -0,0 +1,12 @@ +goos: linux +goarch: amd64 +pkg: github.com/grafana/loki/pkg/logql/log +cpu: AMD Ryzen 9 5950X 16-Core Processor +Benchmark_Pipeline/pipeline_bytes-32 153394 7749 ns/op 5082 B/op 37 allocs/op +Benchmark_Pipeline/pipeline_string-32 153319 7691 ns/op 5146 B/op 38 allocs/op +Benchmark_Pipeline/line_extractor_bytes-32 148069 7922 ns/op 5151 B/op 37 allocs/op +Benchmark_Pipeline/line_extractor_string-32 149070 7900 ns/op 5149 B/op 37 allocs/op +Benchmark_Pipeline/label_extractor_bytes-32 146860 7952 ns/op 5148 B/op 37 allocs/op +Benchmark_Pipeline/label_extractor_string-32 147686 7940 ns/op 5148 B/op 37 allocs/op +PASS +ok github.com/grafana/loki/pkg/logql/log 190.270s diff --git a/pkg/logql/log/cpu-2.out b/pkg/logql/log/cpu-2.out new file mode 100644 index 000000000000..ee5e47d02464 Binary files /dev/null and b/pkg/logql/log/cpu-2.out differ diff --git a/pkg/logql/log/fmt.go b/pkg/logql/log/fmt.go index e28f5a119a48..9257834eee34 100644 --- a/pkg/logql/log/fmt.go +++ b/pkg/logql/log/fmt.go @@ -221,7 +221,10 @@ func (lf *LineFormatter) Process(ts int64, line []byte, lbs *LabelsBuilder) ([]b lf.currentLine = line lf.currentTs = ts - if err := lf.Template.Execute(lf.buf, lbs.Map()); err != nil { + // map now is taking from a pool + m := lbs.Map() + defer smp.Put(m) + if err := lf.Template.Execute(lf.buf, m); err != nil { lbs.SetErr(errTemplateFormat) lbs.SetErrorDetails(err.Error()) return line, true @@ -380,7 +383,8 @@ func (lf *LabelsFormatter) Process(ts int64, l []byte, lbs *LabelsBuilder) ([]by lf.currentLine = l lf.currentTs = ts - var data interface{} + var m = smp.Get() + defer smp.Put(m) for _, f := range lf.formats { if f.Rename { v, category, ok := lbs.GetWithCategory(f.Value) @@ -391,10 +395,10 @@ func (lf *LabelsFormatter) Process(ts int64, l []byte, lbs *LabelsBuilder) ([]by continue } lf.buf.Reset() - if data == nil { - data = lbs.Map() + if len(m) == 0 { + lbs.IntoMap(m) } - if err := f.tmpl.Execute(lf.buf, data); err != nil { + if err := f.tmpl.Execute(lf.buf, m); err != nil { lbs.SetErr(errTemplateFormat) lbs.SetErrorDetails(err.Error()) continue diff --git a/pkg/logql/log/labels.go b/pkg/logql/log/labels.go index 7bc313c8c302..567c446b8c00 100644 --- a/pkg/logql/log/labels.go +++ b/pkg/logql/log/labels.go @@ -3,6 +3,7 @@ package log import ( "fmt" "sort" + "sync" "github.com/prometheus/prometheus/model/labels" @@ -437,6 +438,52 @@ func (b *LabelsBuilder) UnsortedLabels(buf labels.Labels, categories ...LabelCat return buf } +type stringMapPool struct { + pool sync.Pool +} + +func newStringMapPool() *stringMapPool { + return &stringMapPool{ + pool: sync.Pool{ + New: func() interface{} { + return make(map[string]string) + }, + }, + } +} + +func (s *stringMapPool) Get() map[string]string { + m := s.pool.Get().(map[string]string) + clear(m) + return m +} + +func (s *stringMapPool) Put(m map[string]string) { + s.pool.Put(m) +} + +var smp = newStringMapPool() + +// puts labels entries into an existing map, it is up to the caller to +// properly clear the map if it is going to be reused +func (b *LabelsBuilder) IntoMap(m map[string]string) { + if !b.hasDel() && !b.hasAdd() && !b.HasErr() { + if b.baseMap == nil { + b.baseMap = b.base.Map() + for k, v := range b.baseMap { + m[k] = v + } + } + return + } + b.buf = b.UnsortedLabels(b.buf) + // todo should we also cache maps since limited by the result ? + // Maps also don't create a copy of the labels. + for _, l := range b.buf { + m[l.Name] = l.Value + } +} + func (b *LabelsBuilder) Map() map[string]string { if !b.hasDel() && !b.hasAdd() && !b.HasErr() { if b.baseMap == nil { @@ -447,7 +494,8 @@ func (b *LabelsBuilder) Map() map[string]string { b.buf = b.UnsortedLabels(b.buf) // todo should we also cache maps since limited by the result ? // Maps also don't create a copy of the labels. - res := make(map[string]string, len(b.buf)) + res := smp.Get() + clear(res) for _, l := range b.buf { res[l.Name] = l.Value } diff --git a/pkg/logql/log/last b/pkg/logql/log/last new file mode 100644 index 000000000000..b96c8a7ea696 --- /dev/null +++ b/pkg/logql/log/last @@ -0,0 +1,12 @@ +goos: linux +goarch: amd64 +pkg: github.com/grafana/loki/pkg/logql/log +cpu: AMD Ryzen 9 5950X 16-Core Processor +Benchmark_Pipeline/pipeline_bytes-32 172089 6673 ns/op 1447 B/op 35 allocs/op +Benchmark_Pipeline/pipeline_string-32 179335 6670 ns/op 1511 B/op 36 allocs/op +Benchmark_Pipeline/line_extractor_bytes-32 172724 6853 ns/op 1513 B/op 35 allocs/op +Benchmark_Pipeline/line_extractor_string-32 170238 6866 ns/op 1513 B/op 35 allocs/op +Benchmark_Pipeline/label_extractor_bytes-32 169942 7004 ns/op 1513 B/op 35 allocs/op +Benchmark_Pipeline/label_extractor_string-32 168538 6982 ns/op 1513 B/op 35 allocs/op +PASS +ok github.com/grafana/loki/pkg/logql/log 7.650s diff --git a/pkg/logql/log/log.test b/pkg/logql/log/log.test new file mode 100755 index 000000000000..6f07362505cc Binary files /dev/null and b/pkg/logql/log/log.test differ diff --git a/pkg/logql/log/mapPool b/pkg/logql/log/mapPool new file mode 100644 index 000000000000..b28f0868202d --- /dev/null +++ b/pkg/logql/log/mapPool @@ -0,0 +1,12 @@ +goos: linux +goarch: amd64 +pkg: github.com/grafana/loki/pkg/logql/log +cpu: AMD Ryzen 9 5950X 16-Core Processor +Benchmark_Pipeline/pipeline_bytes-32 183506 6356 ns/op 1422 B/op 33 allocs/op +Benchmark_Pipeline/pipeline_string-32 182916 6377 ns/op 1486 B/op 34 allocs/op +Benchmark_Pipeline/line_extractor_bytes-32 173494 6676 ns/op 1489 B/op 33 allocs/op +Benchmark_Pipeline/line_extractor_string-32 175282 6797 ns/op 1489 B/op 33 allocs/op +Benchmark_Pipeline/label_extractor_bytes-32 172417 6954 ns/op 1489 B/op 33 allocs/op +Benchmark_Pipeline/label_extractor_string-32 173976 6749 ns/op 1489 B/op 33 allocs/op +PASS +ok github.com/grafana/loki/pkg/logql/log 7.650s diff --git a/pkg/logql/log/mapPool-2 b/pkg/logql/log/mapPool-2 new file mode 100644 index 000000000000..ddcaab6d065a --- /dev/null +++ b/pkg/logql/log/mapPool-2 @@ -0,0 +1,145 @@ +goos: linux +goarch: amd64 +pkg: github.com/grafana/loki/pkg/logql/log +cpu: AMD Ryzen 9 5950X 16-Core Processor +Benchmark_LineFilter/default_true_foo.*-32 38151235 33.71 ns/op 0 B/op 0 allocs/op +Benchmark_LineFilter/simplified_true_foo.*-32 137415068 8.667 ns/op 0 B/op 0 allocs/op +Benchmark_LineFilter/default_false_foo.*-32 36657951 34.40 ns/op 0 B/op 0 allocs/op +Benchmark_LineFilter/simplified_false_foo.*-32 122026106 10.14 ns/op 0 B/op 0 allocs/op +Benchmark_LineFilter/default_true_(?i)foo-32 685251 1844 ns/op 0 B/op 0 allocs/op +Benchmark_LineFilter/simplified_true_(?i)foo-32 6627051 172.0 ns/op 0 B/op 0 allocs/op +Benchmark_LineFilter/default_false_(?i)foo-32 670104 1869 ns/op 0 B/op 0 allocs/op +Benchmark_LineFilter/simplified_false_(?i)foo-32 6760113 177.3 ns/op 0 B/op 0 allocs/op +Benchmark_LineFilter/default_true_.*foo.*-32 542223 2356 ns/op 0 B/op 0 allocs/op +Benchmark_LineFilter/simplified_true_.*foo.*-32 138826058 8.461 ns/op 0 B/op 0 allocs/op +Benchmark_LineFilter/default_false_.*foo.*-32 527907 2340 ns/op 0 B/op 0 allocs/op +Benchmark_LineFilter/simplified_false_.*foo.*-32 122260276 9.920 ns/op 0 B/op 0 allocs/op +Benchmark_LineFilter/default_true_.*foo-32 535429 2230 ns/op 0 B/op 0 allocs/op +Benchmark_LineFilter/simplified_true_.*foo-32 143817646 8.291 ns/op 0 B/op 0 allocs/op +Benchmark_LineFilter/default_false_.*foo-32 554611 2180 ns/op 0 B/op 0 allocs/op +Benchmark_LineFilter/simplified_false_.*foo-32 128610806 9.361 ns/op 0 B/op 0 allocs/op +Benchmark_LineFilter/default_true_foo|bar-32 7713898 154.0 ns/op 0 B/op 0 allocs/op +Benchmark_LineFilter/simplified_true_foo|bar-32 56178351 22.09 ns/op 0 B/op 0 allocs/op +Benchmark_LineFilter/default_false_foo|bar-32 7733646 156.7 ns/op 0 B/op 0 allocs/op +Benchmark_LineFilter/simplified_false_foo|bar-32 50851335 23.65 ns/op 0 B/op 0 allocs/op +Benchmark_LineFilter/default_true_foo|bar|buzz-32 7446480 165.1 ns/op 0 B/op 0 allocs/op +Benchmark_LineFilter/simplified_true_foo|bar|buzz-32 47580012 24.81 ns/op 0 B/op 0 allocs/op +Benchmark_LineFilter/default_false_foo|bar|buzz-32 7711191 168.0 ns/op 0 B/op 0 allocs/op +Benchmark_LineFilter/simplified_false_foo|bar|buzz-32 44084361 27.07 ns/op 0 B/op 0 allocs/op +Benchmark_LineFilter/default_true_foo|(bar|buzz)-32 6743854 187.5 ns/op 0 B/op 0 allocs/op +Benchmark_LineFilter/simplified_true_foo|(bar|buzz)-32 49474693 24.89 ns/op 0 B/op 0 allocs/op +Benchmark_LineFilter/default_false_foo|(bar|buzz)-32 6355500 187.8 ns/op 0 B/op 0 allocs/op +Benchmark_LineFilter/simplified_false_foo|(bar|buzz)-32 44581922 27.50 ns/op 0 B/op 0 allocs/op +Benchmark_LineFilter/default_true_foo|bar.*|buzz-32 1375010 895.3 ns/op 0 B/op 0 allocs/op +Benchmark_LineFilter/simplified_true_foo|bar.*|buzz-32 48195949 25.21 ns/op 0 B/op 0 allocs/op +Benchmark_LineFilter/default_false_foo|bar.*|buzz-32 1346467 881.6 ns/op 0 B/op 0 allocs/op +Benchmark_LineFilter/simplified_false_foo|bar.*|buzz-32 43916170 27.01 ns/op 0 B/op 0 allocs/op +Benchmark_LineFilter/default_true_.*foo.*|bar|uzz-32 688521 1740 ns/op 0 B/op 0 allocs/op +Benchmark_LineFilter/simplified_true_.*foo.*|bar|uzz-32 49346318 24.23 ns/op 0 B/op 0 allocs/op +Benchmark_LineFilter/default_false_.*foo.*|bar|uzz-32 691778 1706 ns/op 0 B/op 0 allocs/op +Benchmark_LineFilter/simplified_false_.*foo.*|bar|uzz-32 44886036 26.88 ns/op 0 B/op 0 allocs/op +Benchmark_LineFilter/default_true_((f.*)|foobar.*)|.*buzz-32 1225946 990.5 ns/op 0 B/op 0 allocs/op +Benchmark_LineFilter/simplified_true_((f.*)|foobar.*)|.*buzz-32 26295878 48.02 ns/op 0 B/op 0 allocs/op +Benchmark_LineFilter/default_false_((f.*)|foobar.*)|.*buzz-32 1216020 996.3 ns/op 0 B/op 0 allocs/op +Benchmark_LineFilter/simplified_false_((f.*)|foobar.*)|.*buzz-32 23552031 50.87 ns/op 0 B/op 0 allocs/op +Benchmark_LineFilter/default_true_(?P.*foo.*|bar)-32 745039 1608 ns/op 0 B/op 0 allocs/op +Benchmark_LineFilter/simplified_true_(?P.*foo.*|bar)-32 56299695 21.59 ns/op 0 B/op 0 allocs/op +Benchmark_LineFilter/default_false_(?P.*foo.*|bar)-32 743581 1600 ns/op 0 B/op 0 allocs/op +Benchmark_LineFilter/simplified_false_(?P.*foo.*|bar)-32 51396477 23.81 ns/op 0 B/op 0 allocs/op +Benchmark_LineFilter/default_true_(\s|")+(?i)bar-32 592923 2031 ns/op 0 B/op 0 allocs/op +Benchmark_LineFilter/simplified_true_(\s|")+(?i)bar-32 594696 2039 ns/op 0 B/op 0 allocs/op +Benchmark_LineFilter/default_false_(\s|")+(?i)bar-32 593332 2049 ns/op 0 B/op 0 allocs/op +Benchmark_LineFilter/simplified_false_(\s|")+(?i)bar-32 595462 2047 ns/op 0 B/op 0 allocs/op +Benchmark_LineFilter/default_true_(node:24)_buzz*-32 34552183 35.38 ns/op 0 B/op 0 allocs/op +Benchmark_LineFilter/simplified_true_(node:24)_buzz*-32 34696462 34.55 ns/op 0 B/op 0 allocs/op +Benchmark_LineFilter/default_false_(node:24)_buzz*-32 33236223 35.99 ns/op 0 B/op 0 allocs/op +Benchmark_LineFilter/simplified_false_(node:24)_buzz*-32 33668626 35.78 ns/op 0 B/op 0 allocs/op +Benchmark_LineFilter/default_true_(HTTP/.*\"|HEAD|GET)_(2..|5..)-32 483506 2491 ns/op 0 B/op 0 allocs/op +Benchmark_LineFilter/simplified_true_(HTTP/.*\"|HEAD|GET)_(2..|5..)-32 544736 2233 ns/op 0 B/op 0 allocs/op +Benchmark_LineFilter/default_false_(HTTP/.*\"|HEAD|GET)_(2..|5..)-32 487765 2386 ns/op 0 B/op 0 allocs/op +Benchmark_LineFilter/simplified_false_(HTTP/.*\"|HEAD|GET)_(2..|5..)-32 505735 2401 ns/op 0 B/op 0 allocs/op +Benchmark_LineFilter/default_true_"@l":"(Warning|Error|Fatal)"-32 31796106 38.14 ns/op 0 B/op 0 allocs/op +Benchmark_LineFilter/simplified_true_"@l":"(Warning|Error|Fatal)"-32 32254904 36.92 ns/op 0 B/op 0 allocs/op +Benchmark_LineFilter/default_false_"@l":"(Warning|Error|Fatal)"-32 31895373 36.64 ns/op 0 B/op 0 allocs/op +Benchmark_LineFilter/simplified_false_"@l":"(Warning|Error|Fatal)"-32 31727758 38.02 ns/op 0 B/op 0 allocs/op +Benchmark_LineFilter/default_true_(?:)foo|fatal|exception-32 347808 3469 ns/op 0 B/op 0 allocs/op +Benchmark_LineFilter/simplified_true_(?:)foo|fatal|exception-32 23139100 52.71 ns/op 0 B/op 0 allocs/op +Benchmark_LineFilter/default_false_(?:)foo|fatal|exception-32 347662 3438 ns/op 0 B/op 0 allocs/op +Benchmark_LineFilter/simplified_false_(?:)foo|fatal|exception-32 21433672 55.89 ns/op 0 B/op 0 allocs/op +Benchmark_IPFilter/127.0.0.1-32 219172 5644 ns/op 416 B/op 9 allocs/op +Benchmark_IPFilter/192.168.0.1-192.189.10.12-32 209308 5724 ns/op 415 B/op 9 allocs/op +Benchmark_IPFilter/192.168.4.5/16-32 218125 5401 ns/op 416 B/op 9 allocs/op +BenchmarkLineLabelFilters/foo-32 131752836 9.117 ns/op 0 B/op 0 allocs/op +BenchmarkLineLabelFilters/(foo)-32 135408832 9.053 ns/op 0 B/op 0 allocs/op +BenchmarkLineLabelFilters/(foo|ba)-32 89578142 13.30 ns/op 0 B/op 0 allocs/op +BenchmarkLineLabelFilters/(foo|ba|ar)-32 67785404 17.53 ns/op 0 B/op 0 allocs/op +BenchmarkLineLabelFilters/(foo|(ba|ar))-32 67866519 17.71 ns/op 0 B/op 0 allocs/op +BenchmarkLineLabelFilters/foo.*-32 79162518 14.94 ns/op 0 B/op 0 allocs/op +BenchmarkLineLabelFilters/.*foo.*-32 79812434 15.00 ns/op 0 B/op 0 allocs/op +BenchmarkLineLabelFilters/(.*)(foo).*-32 81738111 14.58 ns/op 0 B/op 0 allocs/op +BenchmarkLineLabelFilters/(foo.*|.*ba)-32 68743644 17.68 ns/op 0 B/op 0 allocs/op +BenchmarkLineLabelFilters/(foo.*|.*bar.*)-32 67988179 17.80 ns/op 0 B/op 0 allocs/op +BenchmarkLineLabelFilters/.*foo.*|bar-32 65331152 17.52 ns/op 0 B/op 0 allocs/op +BenchmarkLineLabelFilters/.*foo|bar-32 68870803 17.54 ns/op 0 B/op 0 allocs/op +BenchmarkLineLabelFilters/(?:.*foo.*|bar)-32 67384971 17.38 ns/op 0 B/op 0 allocs/op +BenchmarkLineLabelFilters/(?P.*foo.*|bar)-32 67459786 17.38 ns/op 0 B/op 0 allocs/op +BenchmarkLineLabelFilters/.*foo.*|bar|buzz-32 68189577 17.57 ns/op 0 B/op 0 allocs/op +BenchmarkLineLabelFilters/.*foo.*|bar|uzz-32 59306607 20.23 ns/op 0 B/op 0 allocs/op +BenchmarkLineLabelFilters/foo|bar|b|buzz|zz-32 38298559 31.95 ns/op 0 B/op 0 allocs/op +BenchmarkLineLabelFilters/f|foo|foobar-32 73199528 16.04 ns/op 0 B/op 0 allocs/op +BenchmarkLineLabelFilters/f.*|foobar.*|.*buzz-32 62954108 19.15 ns/op 0 B/op 0 allocs/op +BenchmarkLineLabelFilters/((f.*)|foobar.*)|.*buzz-32 63847633 19.13 ns/op 0 B/op 0 allocs/op +BenchmarkLineLabelFilters/.*-32 597892452 2.002 ns/op 0 B/op 0 allocs/op +BenchmarkLineLabelFilters/.*|.*-32 599336366 2.028 ns/op 0 B/op 0 allocs/op +BenchmarkLineLabelFilters/.*||||-32 589706043 2.027 ns/op 0 B/op 0 allocs/op +BenchmarkLineLabelFilters/#00-32 597831002 2.045 ns/op 0 B/op 0 allocs/op +BenchmarkLineLabelFilters/(?i)foo-32 132216960 9.082 ns/op 0 B/op 0 allocs/op +BenchmarkLineLabelFilters/(?i)界-32 133050820 9.099 ns/op 0 B/op 0 allocs/op +BenchmarkLineLabelFilters/(?i)ïB-32 132711472 9.095 ns/op 0 B/op 0 allocs/op +BenchmarkLineLabelFilters/(?:)foo|fatal|exception-32 59412402 20.25 ns/op 0 B/op 0 allocs/op +BenchmarkLineLabelFilters/(?i)foo|fatal|exception-32 63390085 19.01 ns/op 0 B/op 0 allocs/op +BenchmarkLineLabelFilters/(?i)f|foo|foobar-32 82988314 14.56 ns/op 0 B/op 0 allocs/op +BenchmarkLineLabelFilters/(?i)f|fatal|e.*-32 68591342 17.30 ns/op 0 B/op 0 allocs/op +BenchmarkLineLabelFilters/(?i).*foo.*-32 89400224 13.22 ns/op 0 B/op 0 allocs/op +Benchmark_Parser/json/no_labels_hints-32 494869 2361 ns/op 280 B/op 18 allocs/op +Benchmark_Parser/json/labels_hints-32 756115 1578 ns/op 176 B/op 12 allocs/op +Benchmark_Parser/json/inline_stages-32 2256870 531.7 ns/op 64 B/op 4 allocs/op +Benchmark_Parser/jsonParser-not_json_line/no_labels_hints-32 20541764 58.50 ns/op 0 B/op 0 allocs/op +Benchmark_Parser/jsonParser-not_json_line/labels_hints-32 22325911 55.04 ns/op 0 B/op 0 allocs/op +Benchmark_Parser/jsonParser-not_json_line/inline_stages-32 21640119 56.22 ns/op 0 B/op 0 allocs/op +Benchmark_Parser/unpack/no_labels_hints-32 3555292 334.3 ns/op 80 B/op 4 allocs/op +Benchmark_Parser/unpack/labels_hints-32 3595738 332.1 ns/op 80 B/op 4 allocs/op +Benchmark_Parser/unpack/inline_stages-32 3591871 335.9 ns/op 80 B/op 4 allocs/op +Benchmark_Parser/unpack-not_json_line/no_labels_hints-32 100000000 11.37 ns/op 0 B/op 0 allocs/op +Benchmark_Parser/unpack-not_json_line/labels_hints-32 100000000 11.23 ns/op 0 B/op 0 allocs/op +Benchmark_Parser/unpack-not_json_line/inline_stages-32 100000000 11.21 ns/op 0 B/op 0 allocs/op +Benchmark_Parser/logfmt/no_labels_hints-32 742243 1539 ns/op 336 B/op 16 allocs/op +Benchmark_Parser/logfmt/labels_hints-32 723044 1588 ns/op 336 B/op 16 allocs/op +Benchmark_Parser/logfmt/inline_stages-32 2310529 516.1 ns/op 74 B/op 6 allocs/op +Benchmark_Parser/regex_greedy/no_labels_hints-32 428275 2798 ns/op 193 B/op 2 allocs/op +Benchmark_Parser/regex_greedy/labels_hints-32 423408 2831 ns/op 192 B/op 2 allocs/op +Benchmark_Parser/regex_greedy/inline_stages-32 421518 2786 ns/op 193 B/op 2 allocs/op +Benchmark_Parser/regex_status_digits/no_labels_hints-32 5650633 211.7 ns/op 51 B/op 2 allocs/op +Benchmark_Parser/regex_status_digits/labels_hints-32 5602600 212.3 ns/op 51 B/op 2 allocs/op +Benchmark_Parser/regex_status_digits/inline_stages-32 5722987 208.5 ns/op 51 B/op 2 allocs/op +Benchmark_Parser/pattern/no_labels_hints-32 9893188 119.6 ns/op 35 B/op 2 allocs/op +Benchmark_Parser/pattern/labels_hints-32 10805054 110.3 ns/op 32 B/op 1 allocs/op +Benchmark_Parser/pattern/inline_stages-32 11540605 103.9 ns/op 3 B/op 1 allocs/op +BenchmarkKeyExtraction/json-32 6076245 194.7 ns/op 5 B/op 1 allocs/op +BenchmarkKeyExtraction/logfmt-32 8722742 136.3 ns/op 5 B/op 1 allocs/op +BenchmarkKeyExtraction/logfmt-expression-32 3464037 346.2 ns/op 4 B/op 1 allocs/op +BenchmarkJsonExpressionParser/json-expression-32 1308164 916.0 ns/op 112 B/op 10 allocs/op +Benchmark_Pipeline/pipeline_bytes-32 183174 6456 ns/op 1453 B/op 34 allocs/op +Benchmark_Pipeline/pipeline_string-32 180760 6470 ns/op 1517 B/op 35 allocs/op +Benchmark_Pipeline/line_extractor_bytes-32 172455 6756 ns/op 1520 B/op 34 allocs/op +Benchmark_Pipeline/line_extractor_string-32 174583 6741 ns/op 1520 B/op 34 allocs/op +Benchmark_Pipeline/label_extractor_bytes-32 173482 6820 ns/op 1522 B/op 34 allocs/op +Benchmark_Pipeline/label_extractor_string-32 171506 6833 ns/op 1520 B/op 34 allocs/op +BenchmarkJSONParser-32 727914 1444 ns/op 904 B/op 11 allocs/op +BenchmarkJSONParserInvalidLine-32 2764609 433.3 ns/op 248 B/op 7 allocs/op +BenchmarkJSONExpressionParser-32 995520 1041 ns/op 744 B/op 11 allocs/op +BenchmarkJSONExpressionParserInvalidLine-32 3884377 303.3 ns/op 184 B/op 7 allocs/op +BenchmarkLogfmtParser-32 363714 3149 ns/op 1512 B/op 24 allocs/op +BenchmarkLogfmtExpressionParser-32 567150 2071 ns/op 474 B/op 11 allocs/op +PASS +ok github.com/grafana/loki/pkg/logql/log 195.769s diff --git a/pkg/logql/log/mapPool-3 b/pkg/logql/log/mapPool-3 new file mode 100644 index 000000000000..e1153e18a87d --- /dev/null +++ b/pkg/logql/log/mapPool-3 @@ -0,0 +1,12 @@ +goos: linux +goarch: amd64 +pkg: github.com/grafana/loki/pkg/logql/log +cpu: AMD Ryzen 9 5950X 16-Core Processor +Benchmark_Pipeline/pipeline_bytes-32 180068 6571 ns/op 1455 B/op 34 allocs/op +Benchmark_Pipeline/pipeline_string-32 179401 6597 ns/op 1518 B/op 35 allocs/op +Benchmark_Pipeline/line_extractor_bytes-32 158112 6923 ns/op 1521 B/op 34 allocs/op +Benchmark_Pipeline/line_extractor_string-32 150291 7061 ns/op 1521 B/op 34 allocs/op +Benchmark_Pipeline/label_extractor_bytes-32 166911 7037 ns/op 1521 B/op 34 allocs/op +Benchmark_Pipeline/label_extractor_string-32 169440 6983 ns/op 1522 B/op 34 allocs/op +PASS +ok github.com/grafana/loki/pkg/logql/log 7.548s diff --git a/pkg/logql/log/mem-2.out b/pkg/logql/log/mem-2.out new file mode 100644 index 000000000000..c3a079a13b01 Binary files /dev/null and b/pkg/logql/log/mem-2.out differ diff --git a/pkg/logql/log/profile.out b/pkg/logql/log/profile.out new file mode 100644 index 000000000000..80c1e5fd1f6d Binary files /dev/null and b/pkg/logql/log/profile.out differ