Skip to content

6.0.0

Compare
Choose a tag to compare
@k0kubun k0kubun released this 21 Sep 00:49
· 115 commits to main since this release
3a6f147

Haml 6 became 1.7x faster than Haml 5, and it's now faster than Slim and Erubi in this benchmark that was originally written by Slim developers.

$ bundle exec ruby benchmark/slim/run-benchmarks.rb
Calculating -------------------------------------
       erubi v1.11.0    34.595k i/100ms
         slim v4.1.0    30.931k i/100ms
  haml v6.0.0.beta.1    35.621k i/100ms
-------------------------------------------------
       erubi v1.11.0    411.827k (± 0.4%) i/s -      2.076M
         slim v4.1.0    361.660k (± 0.4%) i/s -      1.825M
  haml v6.0.0.beta.1    427.207k (± 0.6%) i/s -      2.137M

Comparison:
  haml v6.0.0.beta.1:   427206.9 i/s
       erubi v1.11.0:   411826.6 i/s - 1.04x slower
         slim v4.1.0:   361659.8 i/s - 1.18x slower

Changes

  • Replace the implementation with Hamlit
    • Haml 6 is about 1.7x faster than Haml 5 in this benchmark.
    • The parser is kept as is, but everything else is replaced.
    • The haml CLI interface was also replaced.
    • The interface of Haml::Engine is changed. Haml::Template is most likely what you need now.
    • Most Haml helpers are removed.
      • Rails:
        • Kept: find_and_reserve, preserve, surround, precede, succeed, capture_haml
        • Removed: block_is_haml?, flatten, haml_concat, haml_indent, haml_tag, haml_tag_if, html_attrs,
          html_escape, init_haml_helpers, is_haml?, list_of, non_haml, tab_down, tab_up, with_tabs
      • Tilt:
        • Kept: preserve
        • Removed: block_is_haml?, capture_haml, escape_once, find_and_preserve, flatten, haml_concat,
          haml_indent, haml_tag, haml_tag_if, html_attrs, html_escape, init_haml_helpers, is_haml?,
          list_of, non_haml, precede, succeed, surround, tab_down, tab_up, with_tabs
    • Only the attributes in Haml::AttributeBuilder::BOOLEAN_ATTRIBUTES
      are handled as boolean attributes.
    • Some legacy Rails integration is removed.