|
1 |
| -<div align="center"> |
| 1 | +<div align="center run: cargo install --verbose --git https://github.com/aiken-lang/aiken.git"> |
2 | 2 | <hr />
|
3 |
| - <h2 align="center" style="border-bottom: none"><img style="position: relative; top: 0.25rem;" src="https://raw.githubusercontent.com/aiken-lang/branding/main/assets/icon.png" alt="Aiken" height="30" /> aiken/bench</h2> |
| 3 | + <h2 align="center" style="border-bottom: none"><img style="position: relative; top: 0.25rem;" src="https://raw.githubusercontent.com/aiken-lang/branding/main/assets/icon.png" alt="Aiken" height="30" /> aiken/sample</h2> |
4 | 4 |
|
5 |
| -[](https://github.com/aiken-lang/bench/blob/main/LICENSE) |
6 |
| -[](https://github.com/aiken-lang/bench/actions/workflows/continuous-integration.yml) |
| 5 | +[](https://github.com/aiken-lang/sample/blob/main/LICENSE) |
| 6 | +[](https://github.com/aiken-lang/sample/actions/workflows/continuous-integration.yml) |
7 | 7 | <hr/>
|
8 | 8 | </div>
|
9 | 9 |
|
10 | 10 | The official library for writing _samplers_ (a.k.a Scaled Fuzzers) for the [Aiken](https://aiken-lang.org) Cardano smart-contract language.
|
11 | 11 |
|
12 |
| -> ### ⚠️ WARNING |
13 |
| -> |
14 |
| -> **IMPORTANT:** This is a work in progress and the API is not stable yet; additionally Samplers are not yet supported in the current version of Aiken (v1.1.9). |
| 12 | +> [!WARNING] |
| 13 | +> |
| 14 | +> This is a work in progress and the API is not stable yet; The sample API for benchmarks is only supported since aiken==1.1.11; |
15 | 15 |
|
16 | 16 | ## Installation
|
17 | 17 |
|
18 | 18 | ```
|
19 |
| -aiken add aiken-lang/bench --version v0.0.0 |
| 19 | +aiken add aiken-lang/sample --version v0.0.0 |
20 | 20 | ```
|
21 | 21 |
|
22 | 22 | ## Getting started
|
23 | 23 |
|
24 |
| -First, make sure you have the [Aiken's user manual about tests](https://aiken-lang.org/language-tour/tests#property-based-test); in particular the section about benchmarking functions. |
| 24 | +```aiken |
| 25 | +use aiken/sample.{Linear} |
25 | 26 |
|
26 |
| -In many situations, you can use primitives from this library out-of-the-box, composing them inline when necessary. For example, if you need a growing non-empty list of values, you can simply write: |
27 |
| - |
28 |
| -``` |
29 |
| -use aiken/bench |
| 27 | +fn my_function(n: Int) -> Int { |
| 28 | + n * 2 |
| 29 | +} |
30 | 30 |
|
31 |
| -bench my_bench(xs via bench.list(bench.int(Linear(1)), Linear(1))) { |
32 |
| - // some function |
| 31 | +bench multiply_bench(n via sample.int(Linear(5))) { |
| 32 | + my_function(n) |
33 | 33 | }
|
34 | 34 | ```
|
35 | 35 |
|
36 |
| -You can also write your own more complex sampler. Note that writing good samplers can be complicated, so here are a few guiding principles you should follow.. TODO |
| 36 | +> [!TIP] |
| 37 | +> |
| 38 | +> For more information, read the [user manual](https://aiken-lang.org/language-tour/bench). |
0 commit comments