Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/isaac-defrain/bench
Benchmarking OCaml patterns
https://github.com/isaac-defrain/bench
benchmark ocaml
Last synced: about 1 month ago
JSON representation
Benchmarking OCaml patterns
- Host: GitHub
- URL: https://github.com/isaac-defrain/bench
- Owner: Isaac-DeFrain
- License: mit
- Created: 2022-07-18T23:05:39.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2022-07-30T23:36:08.000Z (over 2 years ago)
- Last Synced: 2023-03-06T13:57:27.320Z (almost 2 years ago)
- Topics: benchmark, ocaml
- Language: OCaml
- Homepage:
- Size: 14.6 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# bench
Benchmarking differnet patterns in OCaml
## Benchmarking
To do the benchmark on your own machine, clone the repo
```bash
$ git clone https://github.com/Isaac-DeFrain/bench.git
$ cd bench
```Install dependencies and build
```bash
$ opam install --deps-only .
$ dune build
```To run the desired benchmarks, uncomment the appropriate line in `./bin/main.ml` and do
```bash
$ dune exec -- ./_build/default/bin/main.exe
```## Discoveries
Here are some interesting discoveries:
- manipulating ADTs is slightly slower than manipulating the correponding GADTs
- pattern matching on ADTs is faster than the corresponding GADTs
- `Async` functions are faster then their `Stdlib` counterparts and significantly faster than their `Lwt` counterparts
- `Stdlib` functions are faster than their `Base` library counterparts
- tail-recursive list pattern matching is faster than folding over a list
- updating a mutable reference is faster than tail-recursion