A Wasm component optimizer (mostly a wrapper around wasm-opt)

Overview

component-opt

An optimizer for Wasm Components

Crates.io version Download docs.rs docs

Current Status

This project currently only offers one optimization and does not allow it to be configured.

That optimization is simply to unpack the modules within the component and optimize them. It makes extensive use of

  • wasmparser for parsing components,
  • wasm-opt for performing module optimization, and
  • wasm-encoder for constructing th output component.

The current testing methodology is explained in the Tests README

Goals

In the long run, I'd like this project to evolve to include "Component-aware" optimizations.

I've created a Optimization Pass Issue Tracker for proposed optimization passes.

You might also like...
Rust SDK wrapper for the Mystic Light SDK

mystic_light_sdk Rust SDK wrapper for the Mystic Light SDK Requirements Any MSI device with RGB support Only Windows 7+ Dragon Center or Msi Center in

A Rust wrapper of pmem/syscall_intercept.

syscall-intercept-rs A Rust wrapper of pmem/syscall_intercept, a system call intercepting library on x86_64 Linux. Usage Install dependencies: sudo ap

Rust wrapper for the Google Places API. Access their hundreds of millions of places, reviews, and ratings.

Google Places API Working Examples cargo run --example nearby_search cargo run --example place_details cargo run --example find_place cargo run --exam

Cargo wrapper for working with Webassembly wasi(x).

cargo-wasix A cargo subcommand that wraps regular cargo commands for compiling Rust code to wasix, a superset of Websassembly wasi with additional fun

A reactive DOM library for Rust in WASM

maple A VDOM-less web library with fine-grained reactivity. Getting started The recommended build tool is Trunk. Start by adding maple-core to your Ca

A low-ish level tool for easily writing and hosting WASM based plugins.

A low-ish level tool for easily writing and hosting WASM based plugins. The goal of wasm_plugin is to make communicating across the host-plugin bounda

wasm actor system based on lunatic

Wactor WASM actor system based on lunatic. Actors run on isolated green threads. They cannot share memory, and communicate only through input and outp

BSV stdlib written in Rust and runs in WASM environments

BSV.WASM A Rust/WASM Library to interact with Bitcoin SV Installation NodeJS: npm i bsv-wasm --save Web: npm i bsv-wasm-web --save Rust: https://crate

A wasm interpreter written by rust

A wasm interpreter written by rust

Comments
  • Module/Instance Inlining

    Module/Instance Inlining

    It's possible combine together modules whose instances have export-alias-import relationships.

    Benefits:

    • Further module-level optimizations may now be possible.
    • It may enable more dead item and dead module export elimination, reducing code size.

    Considerations:

    • If there are modules which are completely disconnected/independent from others, it may not make sense to merge them.
    • If any modules are instantiated multiple times, this optimization could duplicate information depending on how it is configured.
    • If multiple instances define memories, then the resulting module may require multi-memory even if none of them individually did.
    optimization-pass 
    opened by esoterra 0
  • Dead Module Export Elimination

    Dead Module Export Elimination

    For any module which is not exported by the containing component, nothing can observe its imports and exports but that component.

    So if an export of that module is not aliased in any instance of the module, that export can be removed from the module potentially enabling further module-level optimizations.

    optimization-pass 
    opened by esoterra 0
  • Canonical Option Elimination

    Canonical Option Elimination

    Sometimes we can tell that a given Canonical Option doesn't affect the behavior of the component and can be removed.

    The most obvious case is that neither a memory nor realloc option is needed if

    • the total flat size of its parameters is less than MAX_FLAT_PARAMS,
    • the total flat size of its return values is less than MAX_FLAT_RESULTS,
    • and none of the param or result types transitively include allocating types (e.g. list<T>, string).

    A more subtle case that may be too niche but could be considered is detecting that the post-return function has no side effects (likely due to other optimizations) and can be removed.

    optimization-pass 
    opened by esoterra 0
  • Component-Aware Optimizations (Tracking)

    Component-Aware Optimizations (Tracking)

    In the future, I'd like this project to expand to offer Component-aware optimization passes.

    This issue will act to track proposed optimization passes and be updated in place.

    • [ ] #2
    • [ ] #3
    • [ ] #4
    • [ ] #5
    • [ ] #6
    opened by esoterra 2
Owner
Robin Brown
Working on Wasm at SingleStore
Robin Brown
Thin wrapper around [`tokio::process`] to make it streamable

This library provide ProcessExt to create your own custom process

null 4 Jun 25, 2022
prelate-rs is an idiomatic, asynchronous Rust wrapper around the aoe4world API. Very much a WIP at this stage.

prelate-rs is an idiomatic, asynchronous Rust wrapper around the aoe4world API. Very much a WIP at this stage. Project Status We currently support the

William Findlay 4 Dec 29, 2022
A mostly drop-in replacement for mercantile written w/ rust, plus several other util(e)ities.

utiles utiles = utils + tiles A mostly drop-in replacement for mercantile written w/ rust, plus several other util(e)ities. Installation pip install u

jesse 5 Jun 20, 2023
Component-based state machine plugin for Bevy

seldom_state is a component-based state machine plugin for Bevy. It's useful for AI, player state, and other entities that occupy various states. It allows for greater reusability of state logic between entities, compared to managing mutually-exclusive components directly in your systems.

Seldom 43 Jan 2, 2023
Utilities and tools based around Amazon S3 to provide convenience APIs in a CLI

s3-utils Utilities and tools based around Amazon S3 to provide convenience APIs in a CLI. This tool contains a small set of command line utilities for

Isaac Whitfield 47 Dec 15, 2022
The Dutch secret service (AIVD) has a yearly puzzle challenge around Christmas

AIVD kerstpuzzel 2021 18 solver The Dutch secret service (AIVD) has a yearly puzzle challenge around Christmas, called the 'AIVD kerstpuzzel'. This re

Tim Visée 2 Mar 7, 2022
Fast, compact and all-around subdomain enumeration tool written in Rust

Fast, compact and all-around subdomain enumeration tool written in Rust, which uses dns bruteforce, internet search and recursive http content search.

foreseon 16 Dec 10, 2022
Another attempt at creating a wrapper for fastcdc in node.js

Another attempt at creating a wrapper for fastcdc in node.js. This time using wasmbindgen instead of neon.

Mikola Lysenko 5 Jul 28, 2022
A simple wrapper for the detour-rs library that makes making hooks much more concise

A simple wrapper for the detour-rs library that makes making hooks much more concise

Khangaroo 6 Jun 21, 2022
Convenience wrapper for cargo buildscript input/output

A convenience wrapper for cargo buildscript input/output. Why? The cargo buildscript API is (necessarily) stringly-typed.

Christopher Durham 6 Sep 25, 2022