Skip to content

Commit

Permalink
Update README w.r.t. Haml 6
Browse files Browse the repository at this point in the history
  • Loading branch information
k0kubun committed Oct 9, 2022
1 parent a59a103 commit 8c659c2
Showing 1 changed file with 17 additions and 40 deletions.
57 changes: 17 additions & 40 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,22 @@

Hamlit is a high performance [Haml](https://github.com/haml/haml) implementation.

## Project status

**Hamlit's implementation was copied to Haml 6.**
From Haml 6, you don't need to switch to Hamlit.

Both Haml 6 and Hamlit are still maintained by [@k0kubun](https://github.com/k0kubun).
While you don't need to immediately deprecate Hamlit, Haml 6 has more maintainers
and you'd better start a new project with Haml rather than Hamlit,
given no performance difference between them.

## Introduction

### What is Hamlit?
Hamlit is another implementation of [Haml](https://github.com/haml/haml).
With some [limitations](REFERENCE.md#limitations) by design for performance,
Hamlit is **1.94x times faster** than original haml gem in [this benchmark](benchmark/slim/run-benchmarks.rb),
With some [Hamlit's characteristics](REFERENCE.md#hamlits-characteristics) for performance,
Hamlit is **1.94x times faster** than the original Haml 5 in [this benchmark](benchmark/run-benchmarks.rb),
which is an HTML-escaped version of [slim-template/slim's one](https://github.com/slim-template/slim/blob/4.1.0/benchmarks/run-benchmarks.rb) for fairness. ([Result on Travis](https://travis-ci.org/github/k0kubun/hamlit/jobs/732178446))

<img src="https://raw.githubusercontent.com/k0kubun/hamlit/afcc2b36c4861c2f764baa09afd9530ca25eeafa/benchmark/graph/graph.png" width="600x" alt="Hamlit Benchmark" />
Expand All @@ -23,11 +33,12 @@ which is an HTML-escaped version of [slim-template/slim's one](https://github.co
haml v5.2.0: 127834.4 i/s - 1.94x slower
```

### Why is Hamlit faster?
### Why is Hamlit fast?

#### Less string concatenation by design
As written in [limitations](REFERENCE.md#limitations), Hamlit drops some not-so-important features which require
works on runtime. With the optimized language design, we can reduce the string concatenation
As written in [Hamlit's characteristics](REFERENCE.md#hamlits-characteristics),
Hamlit drops some not-so-important features which require works on runtime.
With the optimized language design, we can reduce the string concatenation
to build attributes.

#### Static analyzer
Expand All @@ -42,7 +53,7 @@ with C extension.

## Usage

Hamlit currently supports Ruby 2.1 and higher. See [REFERENCE.md](REFERENCE.md) for detail features of Hamlit.
See [REFERENCE.md](REFERENCE.md) for details.

### Rails

Expand Down Expand Up @@ -97,40 +108,6 @@ $ hamlit render in.haml
## Contributing
### Test latest version
```rb
# Gemfile
gem 'hamlit', github: 'k0kubun/hamlit', submodules: true
```
### Development
Contributions are welcomed. It'd be good to see
[Temple's EXPRESSIONS.md](https://github.com/judofyr/temple/blob/v0.7.6/EXPRESSIONS.md)
to learn Temple which is a template engine framework used in Hamlit.
```bash
$ git clone --recursive https://github.com/k0kubun/hamlit
$ cd hamlit
$ bundle install
# Run all tests
$ bundle exec rake test
# Run one test
$ bundle exec ruby -Ilib:test -rtest_helper test/hamlit/line_number_test.rb -l 12
# Show compiling/rendering result of some template
$ bundle exec exe/hamlit compile in.haml
$ bundle exec exe/hamlit render in.haml
# Use rails app to debug Hamlit
$ cd sample/rails
$ bundle install
$ bundle exec rails s
```
### Reporting an issue
Please report an issue with following information:
Expand Down

0 comments on commit 8c659c2

Please sign in to comment.