Skip to content

Document custom LLVM optimization passes #1018

@cmichi

Description

@cmichi

Please post the results of running the novel LLVM optimization passes on our example contracts in this issue. Also, please document the steps we need to take to reproduce these results here. This will be really helpful for us when deciding which optimization issues to tackle next.

The examples can be found in the examples folder of this repository. Note that the examples/delegator has multiple contracts in it, the readme lists the four contracts.

Please use the examples from the ink! master branch for your evaluation, we haven't released all optimizations yet.

For the comparison it's important that the contracts are build with cargo-contract in its latest version (currently 0.15.0). This is because we already do a number of optimizations there. You can install the latest version via cargo install cargo-contract --force --locked.

A dependency of the tool is wasm-opt, you can download a binary directly from here. The version should be at least 101, you can query your local version via wasm-opt --version.

For building the individual examples you should use

cargo +nightly contract build \
  --release \
  --output-json \
  --manifest-path=/home/michi/projects/ink/examples/flipper/Cargo.toml | \
jq .optimization_result.optimized_size

The --release is really important, this way the contracts won't contain any debugging logic. The printed number is the final optimized size in kb, this is the number we are looking for.

Metadata

Metadata

Assignees

No one assigned

    Labels

    B-researchResearch task that has open questions that need to be resolved.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions