Skip to content

Size optimisation #163

@ColinEberhardt

Description

@ColinEberhardt

I'm using this toolchain in order to create a simple wasm module for use with wagi. The wasm module size has a significant impact on the time it takes to respond to a request - as per deislabs/wagi#3

With this simple example:

#include <iostream>

using namespace std;

int main() {
  cout << "Content-Type: text/plain\n";
  cout << "\n";
  cout << "hello world C++";
}

Compiled as follows:

/wasi-sdk-11.0/bin/clang++ --sysroot=/wasi-sdk-11.0/share/wasi-sysroot  test.cpp -o test.wasm

The test.wasm output is 606 KBytes.

If I optimise with wasm-opt:

wasm-opt -Oz test.wasm -o test.wasm

It drops to 209 KBytes, which is still a lot larger than I'd expect.

Metadata

Metadata

Assignees

No one assigned

    Labels

    help wantedExtra attention is needed

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions