Skip to content

Move backtrace cleaner from Profiler into its own class

Stan Hu requested to merge sh-backtrace-cleaner-memory into master

We call GitLab::Profiler.clean_backtrace in a lot of places where we aren't actually profiling. It makes sense to break this out into its own class method.

This change also reduces memory usage and speeds up the backtrace cleaner since the regexp is computed once at load time:

Calculating -------------------------------------
                 old   723.000  i/100ms
                 new   733.000  i/100ms
-------------------------------------------------
                 old      7.730k (±22.1%) i/s -     36.873k
                 new      8.027k (±22.2%) i/s -     38.116k

Comparison:
                 new:     8026.5 i/s
                 old:     7730.3 i/s - 1.04x slower

Closes #36645 (closed)

Edited by Stan Hu

Merge request reports