Skip to content

Indent Perfomance #129

@alexesDev

Description

@alexesDev

Hi. I see Arbre::HTML::Tag#indent in stackprof top and it confuses me.

  Mode: cpu(1000)
  Samples: 172 (0.00% miss rate)
  GC: 33 (19.19%)
==================================
     TOTAL    (pct)     SAMPLES    (pct)     FRAME
        33  (19.2%)          33  (19.2%)     (garbage collection)
        29  (16.9%)          29  (16.9%)     ActiveSupport::SafeBuffer#initialize
        14   (8.1%)          13   (7.6%)     Arbre::Element#initialize
        11   (6.4%)          11   (6.4%)     Arbre::HTML::Attributes#value_empty?
        19  (11.0%)           8   (4.7%)     Arbre::HTML::Tag#indent
         7   (4.1%)           7   (4.1%)     ActiveSupport::Inflector#demodulize

I test this patch and got a 10% performance boost.
https://gist.github.com/alexesDev/343e22b45fac02fd7f509bb408874f66

Are indents really needed?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions