github.com/gnolang/gno@v0.0.0-20240520182011-228e9d0192ce/.benchmarks/README.md (about) 1 # Benchmarks 2 3 This folder is where benchmarks are configured to be added on the dashboard generated in [benchmarks](https://gnoland.github.io/benchmarks). 4 5 We are using the [gobenchdata](https://github.com/bobheadxi/gobenchdata) GitHub action to run all our benchmarks and generate the graphs. Use its documentation if you need to do something more complicated than adding some benchmarks from a new package. 6 7 We have two types of benchmarks; slow and fast ones. Slow ones can also be executed as checks on every PR. 8 9 Now let's see how to add your tests to the generated benchmark graphs and also add as checks if they are fast enough on every PR: 10 11 ## Add new benchmarks to generated graphs. 12 13 All benchmarks can be added to these graphs to keep track of the performance evolution on different parts of the code. This is done adding new lines on [gobenchdata-web.yml](https://github.com/gnolang/gno/blob/gh-benchmarks/gobenchdata-web.yml) 14 15 This is eventually copied into [benchmark](https://github.com/gnolang/benchmarks/tree/gh-pages) gh-pages branch and it will be rendered [here](https://gnolang.github.io/benchmarks/). 16 17 Things to take into account: 18 19 - All benchmarks on a package will be shown on the same graph. 20 - The value on `package` and `benchmarks` are regular expressions. 21 - You have to explicitly add your new package here to make it appears on generated graphs. 22 - If you have benchmarks on the same package that takes much more time pero op than the rest, you should divide it into a separate graph for visibility. In this example we can see how we separated tests from the gnolang package into the ones finishing with `Equality` and `LoopyMain`, because `LoopyMain` is taking an order of magnitude more time per operation than the other tests: 23 ```yaml 24 - name: Equality benchmarks (gnovm) 25 benchmarks: [ '.Equality' ] 26 package: github.com\/gnolang\/gno\/gnovm\/pkg\/gnolang 27 - name: LoopyMain benchmarks (gnovm) 28 benchmarks: [ '.LoopyMain' ] 29 package: github.com\/gnolang\/gno\/gnovm\/pkg\/gnolang 30 ``` 31 32 ## Add new checks for PRs 33 34 If we want to add a new package to check all the fast benchmarks on it on every PR, we should have a look into [gobenchdata-checks.yml](./gobenchdata-checks.yml).