Indent Perfomance
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?
@alexesDev nice catch, imo it can be removed in order to get better performance, @activeadmin/collaborators what do u think ?
Yeah, nice catch! I think the pretty HTML output is a nice feature that might be appreciated by some people, so it'd be nice to find a middle ground. Maybe make the "pretty html" an opt-out feature through configuration?
I would accept a PR for this if you’re still interested in the change. Thank you.