Giter Club home page Giter Club logo

canister-profiling's Introduction

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.

How to reproduce performance report

Prerequisites:

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=<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, which wraps wasm-opt.

The following optimizations are applied:

ic-wasm -o <wasm> <wasm> 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.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.