Skip to content

Conversation

@arybczak
Copy link
Member

@arybczak arybczak commented Sep 3, 2025

Turns out that running unspecialized code written with mtl style effects in mind via effectful's Eff is always faster than running via a transformer stack. Crazy.

countdown.1000:

mtl (transformers)
  shallow:        OK
    51.1 μs ± 2.9 μs, 477 KB allocated,  92 B  copied, 6.0 MB peak memory
  deep:           OK
    409  μs ±  33 μs, 3.0 MB allocated, 870 B  copied, 6.0 MB peak memory
mtl (effectful)
  shallow:        OK
    36.4 μs ± 2.9 μs, 260 KB allocated,  71 B  copied, 6.0 MB peak memory
  deep:           OK
    36.9 μs ± 2.9 μs, 267 KB allocated, 179 B  copied, 6.0 MB peak memory

filesize.1000:

mtl (transformers)
  shallow: OK
    973  μs ±  87 μs, 7.2 MB allocated, 349 KB copied, 7.0 MB peak memory
  deep:    OK
    2.20 ms ± 175 μs,  15 MB allocated, 854 KB copied, 8.0 MB peak memory
mtl (effectful)
  shallow: OK
    818  μs ±  44 μs, 6.5 MB allocated, 196 KB copied, 8.0 MB peak memory
  deep:    OK
    883  μs ±  77 μs, 6.6 MB allocated, 210 KB copied, 8.0 MB peak memory

Turns out that running unspecialized code written with mtl style effects in mind
via effectful's `Eff` is always faster than running via a transformer
stack. Crazy.

`countdown.1000`:

```
mtl (transformers)
  shallow:        OK
    51.1 μs ± 2.9 μs, 477 KB allocated,  92 B  copied, 6.0 MB peak memory
  deep:           OK
    409  μs ±  33 μs, 3.0 MB allocated, 870 B  copied, 6.0 MB peak memory
mtl (effectful)
  shallow:        OK
    36.4 μs ± 2.9 μs, 260 KB allocated,  71 B  copied, 6.0 MB peak memory
  deep:           OK
    36.9 μs ± 2.9 μs, 267 KB allocated, 179 B  copied, 6.0 MB peak memory
```

`filesize.1000`:
```
mtl (transformers)
  shallow: OK
    973  μs ±  87 μs, 7.2 MB allocated, 349 KB copied, 7.0 MB peak memory
  deep:    OK
    2.20 ms ± 175 μs,  15 MB allocated, 854 KB copied, 8.0 MB peak memory
mtl (effectful)
  shallow: OK
    818  μs ±  44 μs, 6.5 MB allocated, 196 KB copied, 8.0 MB peak memory
  deep:    OK
    883  μs ±  77 μs, 6.6 MB allocated, 210 KB copied, 8.0 MB peak memory
```
@arybczak arybczak merged commit 012af2c into master Sep 3, 2025
9 checks passed
@arybczak arybczak deleted the bench-mtl-effectful branch September 3, 2025 01:04
@Kleidukos
Copy link
Member

@arybczak I'll have to write something about how the new MTL instances on Eff allow for progressive incorporation of effectful in a codebase.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants