{"id":13523945,"url":"https://github.com/dfinity/canbench","last_synced_at":"2025-09-02T16:56:31.976Z","repository":{"id":221685230,"uuid":"746651802","full_name":"dfinity/canbench","owner":"dfinity","description":"A benchmarking framework for canisters on the Internet Computer.","archived":false,"fork":false,"pushed_at":"2025-03-07T18:20:03.000Z","size":293,"stargazers_count":18,"open_issues_count":5,"forks_count":5,"subscribers_count":13,"default_branch":"main","last_synced_at":"2025-03-15T07:05:08.750Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/dfinity.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":".github/CODEOWNERS","security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-01-22T12:48:09.000Z","updated_at":"2025-03-07T18:20:05.000Z","dependencies_parsed_at":"2024-02-09T13:48:10.190Z","dependency_job_id":"d8d513f7-44c3-4ef7-b650-ea7a305d37cb","html_url":"https://github.com/dfinity/canbench","commit_stats":null,"previous_names":["dfinity/canbench"],"tags_count":8,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dfinity%2Fcanbench","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dfinity%2Fcanbench/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dfinity%2Fcanbench/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dfinity%2Fcanbench/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/dfinity","download_url":"https://codeload.github.com/dfinity/canbench/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245931864,"owners_count":20695963,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-08-01T06:01:05.390Z","updated_at":"2025-09-02T16:56:31.968Z","avatar_url":"https://github.com/dfinity.png","language":"Rust","readme":"\u003cp\u003e\n  \u003ca href=\"https://github.com/dfinity/canbench/blob/main/LICENSE\"\u003e\n    \u003cimg alt=\"Apache-2.0\" src=\"https://img.shields.io/github/license/dfinity/bench\"/\u003e\n  \u003c/a\u003e\n  \u003ca href=\"https://forum.dfinity.org/\"\u003e\n    \u003cimg alt=\"Chat on the Forum\" src=\"https://img.shields.io/badge/help-post%20on%20forum.dfinity.org-blue\"\u003e\n  \u003c/a\u003e\n\u003c/p\u003e\n\n# `canbench`\n\n`canbench` is a tool for benchmarking canisters on the Internet Computer.\n\n## Background\n\nCanister smart contracts on the Internet Computer consume compute and memory resources.  \nSince resources are finite, execution of a message (transaction) must remain within specific bounds:\n\n1. **Instructions**: A monotonically increasing counter correlated with compute and memory usage.\n2. **Dirty Pages**: The number of memory pages written to.\n\nIf a message exceeds these limits, it is aborted.\n`canbench` gives developers insights into how their code consumes instructions and memory. \nSupport for reporting dirty pages will be added once the IC exposes that information.\n\n## Use Cases\n\n- Analyze instruction, heap, and stable memory usage of canisters\n- Detect performance regressions in local or CI environments\n- Identify potential performance bottlenecks\n\n## Features\n\n- **Relevant metrics**\n\n  Traditional benchmarking tools rely on repeated runs and averaging time.  \n  On the deterministic Internet Computer, this is neither necessary nor insightful.  \n  `canbench` reports instruction count and memory changes directly.\n\n- **Regression detection**\n\n  Persist benchmark results in your repo.  \n  `canbench` compares results over time to highlight performance regressions.\n\n- **High instruction limits**\n\n  While regular messages are capped at a few billion instructions, `canbench` supports up to 10 trillion, allowing deep benchmarking.\n\n- **Language-agnostic**\n\n  While currently Rust-focused, `canbench` is designed to support canisters written in any language.\n\n## Installation\n\n```bash\ncargo install canbench\n```\n\n## Quickstart (Rust)\n\nSee the [crate's documentation](https://docs.rs/canbench-rs).\n\n## GitHub CI Support\n\nYou can integrate `canbench` into your GitHub CI pipeline to catch regressions automatically.\n\nYou’ll need:\n\n1. Benchmark scripts (see `scripts/` directory)\n\n2. A workflow that posts benchmarking results as PR comments (`canbench-post-comment.yml`)\n\n3. A job to upload the PR number (see `upload-pr-number` in `ci.yml`)\n\n4. The benchmark job itself (e.g. `benchmark-fibonacci-example` in `ci.yml`)\n\nOnce configured, the job will fail on regressions and pass otherwise.\nIt will also leave a PR comment with detailed results.\nSee [this PR](https://github.com/dfinity/bench/pull/18) example.","funding_links":[],"categories":["Developer Tooling"],"sub_categories":["Benchmarking"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdfinity%2Fcanbench","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdfinity%2Fcanbench","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdfinity%2Fcanbench/lists"}