Commit 4d376c66 authored by Stan Hu's avatar Stan Hu

Remove method instrumentation for Banzai filters and reference parsers

For one README.md file, this instrumentation was adding several seconds and
significant RAM and CPU overhead since these filters often iterate through
all HTML nodes in tight loops.

Relates to #49409
parent dc7b4b7b
---
title: Remove method instrumentation for Banzai filters and reference parsers
merge_request: 20770
author:
type: performance
...@@ -58,20 +58,6 @@ def instrument_classes(instrumentation) ...@@ -58,20 +58,6 @@ def instrument_classes(instrumentation)
instrumentation.instrument_instance_methods(const) instrumentation.instrument_instance_methods(const)
end end
# Instruments all Banzai filters and reference parsers
{
Filter: Rails.root.join('lib', 'banzai', 'filter', '*.rb'),
ReferenceParser: Rails.root.join('lib', 'banzai', 'reference_parser', '*.rb')
}.each do |const_name, path|
Dir[path].each do |file|
klass = File.basename(file, File.extname(file)).camelize
const = Banzai.const_get(const_name).const_get(klass)
instrumentation.instrument_methods(const)
instrumentation.instrument_instance_methods(const)
end
end
instrumentation.instrument_methods(Banzai::Renderer) instrumentation.instrument_methods(Banzai::Renderer)
instrumentation.instrument_methods(Banzai::Querying) instrumentation.instrument_methods(Banzai::Querying)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment