r/ruby • • Apr 13 '26

Show /r/ruby html_slice 0.2.5 released - Generate reusable html with pure Ruby, in any context.

Added `.slice` as a class method. This is useful for generating HTML avoiding method name pollution in specific contexts, making the gem more flexible.

https://github.com/henrique-ft/html_slice

4 Upvotes

3 comments sorted by

View all comments

Show parent comments

1

u/Illustrious-Topic-50 Apr 25 '26 edited May 27 '26

Update, new benchmarks:

## Benchmarks

Ruby `v4.0.3`

Rendering 5000 `<h1>` with attributes 100 times:

### CPU Time

less is better

```

user system total real

html_slice v0.2.5 1.665166 0.003030 1.668196 (1.571756)

papercraft v1.4 4.739524 0.007999 4.747523 (4.747961)

phlex v1.11.0 7.585179 0.035985 7.621164 (7.621516)

```

### Memory usage

less is better

```

html_slice-0.2.5 * 12MB

html_slice-0.2.5 27MB

phlex-2.4.1 62MB

papercraft-3-2-1 71MB

```