diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2022-08-26 09:11:44 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2022-08-26 09:11:44 +0300 |
commit | a5872a7f2bbb54bc6868e862fa1c1729d8182832 (patch) | |
tree | f614ba69284f3237471ae503a6e0a1bfc745c310 /spec/benchmarks/banzai_benchmark.rb | |
parent | c593b347c9e0c362ef123af961e597d709e75521 (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/benchmarks/banzai_benchmark.rb')
-rw-r--r-- | spec/benchmarks/banzai_benchmark.rb | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/spec/benchmarks/banzai_benchmark.rb b/spec/benchmarks/banzai_benchmark.rb index 86f7ee7e90b..7a60825c1e6 100644 --- a/spec/benchmarks/banzai_benchmark.rb +++ b/spec/benchmarks/banzai_benchmark.rb @@ -82,6 +82,11 @@ RSpec.describe 'GitLab Markdown Benchmark', :aggregate_failures do it 'benchmarks all filters in the PlainMarkdownPipeline' do benchmark_pipeline_filters(:plain_markdown) end + + it 'benchmarks specified filters in the FullPipeline' do + filter_klass_list = [Banzai::Filter::MathFilter] + benchmark_pipeline_filters(:full, filter_klass_list) + end end # build up the source text for each filter @@ -105,7 +110,7 @@ RSpec.describe 'GitLab Markdown Benchmark', :aggregate_failures do filter_source end - def benchmark_pipeline_filters(pipeline_type) + def benchmark_pipeline_filters(pipeline_type, filter_klass_list = nil) pipeline = Banzai::Pipeline[pipeline_type] filter_source = build_filter_text(pipeline, markdown_text) @@ -114,7 +119,8 @@ RSpec.describe 'GitLab Markdown Benchmark', :aggregate_failures do Benchmark.ips do |x| x.config(time: 10, warmup: 2) - pipeline.filters.each do |filter_klass| + filters = filter_klass_list || pipeline.filters + filters.each do |filter_klass| label = filter_klass.name.demodulize.delete_suffix('Filter').truncate(20) x.report(label) do |