Skip to content
This repository has been archived by the owner on May 16, 2024. It is now read-only.

Commit

Permalink
Add performance note
Browse files Browse the repository at this point in the history
  • Loading branch information
anuraaga committed Feb 13, 2023
1 parent f3d2fc7 commit fc3b302
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,5 +26,25 @@ Additionally, add `-gc=custom` and `-tags=custommalloc` to your TinyGo build fla
tinygo build -o main.wasm -gc=custom -tags=custommalloc -target=wasi -scheduler=none main.go
```

## Performance

Benchmarks are run against every commit in the [bench][4] workflow. GitHub action runners are highly
virtualized and do not have stable performance across runs, but the relative numbers within a run
should still be somewhat, though not precisely, informative.

One run looks like this

```
BenchmarkGC/bench.wasm-2 52 220294559 ns/op
BenchmarkGC/benchref.wasm-2 6 2000167805 ns/op
```

The benchmark is very simple, allocating some large strings in a loop. We see nottinygc perform almost
10x better in this benchmark. Note that just allocation / collection time is not the only aspect of
GC performance, allocation locality and fragmentation can also affect performance of real-world
applications. We have found that the default allocator can cause applications to run out of memory,
possibly due to fragmentation, whereas this library will continue to run indefinitely.

[1]: https://github.com/ivmai/bdwgc
[2]: https://github.com/microsoft/mimalloc
[4]: https://github.com/wasilibs/nottinygc/actions/workflows/bench.yaml

0 comments on commit fc3b302

Please # to comment.