Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/dfinity/canister-profiling
Collection of canister performance benchmarks
https://github.com/dfinity/canister-profiling
Last synced: 5 days ago
JSON representation
Collection of canister performance benchmarks
- Host: GitHub
- URL: https://github.com/dfinity/canister-profiling
- Owner: dfinity
- License: apache-2.0
- Created: 2022-09-06T23:59:46.000Z (about 2 years ago)
- Default Branch: main
- Last Pushed: 2024-05-30T00:51:08.000Z (5 months ago)
- Last Synced: 2024-08-02T06:16:02.515Z (3 months ago)
- Language: Rust
- Homepage:
- Size: 65.9 MB
- Stars: 21
- Watchers: 22
- Forks: 8
- Open Issues: 17
-
Metadata Files:
- Readme: README.md
- License: LICENSE
- Codeowners: .github/CODEOWNERS
Awesome Lists containing this project
- awesome-internet-computer - canister-profiling - Code & scripts for collecting performance data for canisters. (Developer Tooling / Testing)
README
# canister-profiling
This repository contains code and scripts for collecting performance data for different canisters running on the IC.
Community contributions are strongly encouraged.
## Performance report
Performance reports are generated in `gh-pages` branch. The reported Wasm binary size is after the instrumentation.
* [Sample dapps](http://dfinity.github.io/canister-profiling/dapps)
* [Collection libraries](http://dfinity.github.io/canister-profiling/collections)
* [Cryptographic libraries](http://dfinity.github.io/canister-profiling/crypto)
* [Publisher & Subscriber](http://dfinity.github.io/canister-profiling/pub-sub)
* [Heartbeat / Timer](http://dfinity.github.io/canister-profiling/heartbeat)
* [Motoko specific benchmarks](http://dfinity.github.io/canister-profiling/motoko)## How to reproduce performance report
### Prerequisites:
- [Install Internet Computer SDK](https://sdk.dfinity.org/docs/quickstart/local-quickstart.html)
- [Install ic-wasm](https://github.com/dfinity/ic-wasm/releases)
- [Install ic-repl](https://github.com/dfinity/ic-repl/releases)
- [Install npm](https://nodejs.org/en/download/)
- [Install mops](https://mops.one/docs/install)
```
npm i -g ic-mops
```
- [Install Rust](https://www.rust-lang.org/tools/install)
- Add wasm32 target to Rust
```
rustup target add wasm32-unknown-unknown
```### Running locally:
* Make sure that local replica is configured as system subnet. If not, run `cp networks.json ~/.config/dfx/`
* `dfx start --clean`
* Run `make -e MOC_VERSION=`
* The results are stored in `_out/`## How to create a new benchmark
Each benchmark usually contains multiple implementations written in different languages, e.g., Motoko and Rust.
The folder follows the following structure:```
Benchmark_name/
Makefile
README.md // Perf result will be appended to this markdown file.
perf.sh // ic-repl script that generates perf result. If the candid interface is different, we can use multiple scripts.
motoko/
dfx.json
src/
benchmark1.mo
benchmark2.mo
rust/
dfx.json
benchmark1/
Cargo.toml
benchmark1.did
src/
lib.rs
benchmark2/
Cargo.toml
benchmark2.did
src/
lib.rs
```## Wasm Optimizer
A Wasm optimizer is applied to each Wasm binary before instrumentation. The optimizer can be found in [ic-wasm](https://github.com/dfinity/ic-wasm), which wraps [wasm-opt](https://github.com/WebAssembly/binaryen).
The following optimizations are applied:
```
ic-wasm -o shrink --optimize O3 --keep-name-section
```Note that the name section is preserved in the optimization process. This is because the name section is used by the profiler to produce the flame graphs.
For users who wish to use the optimizer, the easiest way is to enable it via a field in `dfx.json`:
```
{
"canisters": {
"my_canister": {
"optimize": "cycles"
}
}
}
```
This, as in most real world uses, removes the name section to minimize the binary size.