Skip to content

feat: rework instructions #4

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 9 commits into from
Feb 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions BENCHMARKS.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,12 @@ All runtimes are compiled with the following settings:

| Benchmark | Native | TinyWasm\* | Wasmi | Wasmer (Single Pass) |
| ------------ | -------- | ---------- | --------- | -------------------- |
| `fib` | \*\* | ` 43.81µs` | `48.60µs` | ` 43.97µs` |
| `fib-rec` | `0.26ms` | ` 20.99ms` | ` 4.64ms` | ` 0.50ms` |
| `argon2id` | `0.53ms` | `107.77ms` | `47.76ms` | ` 4.49ms` |
| `selfhosted` | `0.06ms` | ` 2.88ms` | ` 6.20ms` | `359.33ms` |
| `fib` | \*\* | ` 43.60µs` | `48.27µs` | ` 44.99µs` |
| `fib-rec` | `0.27ms` | ` 21.13ms` | ` 4.63ms` | ` 0.47ms` |
| `argon2id` | `0.53ms` | ` 99.16ms` | `45.00ms` | ` 4.59ms` |
| `selfhosted` | `0.05ms` | ` 1.84ms` | ` 6.51ms` | `446.48ms` |

_\* converting WASM to TinyWasm bytecode is not included. I takes ~7ms to convert `tinywasm.wasm` to TinyWasm bytecode._
_\* converting WASM to TinyWasm bytecode is not included. I takes ~5.7ms to convert `tinywasm.wasm` to TinyWasm bytecode._
_\*\* essentially instant as it gets computed at compile time._

### Fib
Expand Down
46 changes: 23 additions & 23 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

## Why TinyWasm?

- **Tiny**: TinyWasm is designed to be as small as possible without significantly compromising performance or functionality.
- **Tiny**: TinyWasm is designed to be as small as possible without significantly compromising performance or functionality (< 6000 lines of code).
- **Portable**: TinyWasm runs on any platform that Rust can target, including WebAssembly itself, with minimal external dependencies.
- **Lightweight**: TinyWasm is easy to integrate and has a low call overhead, making it suitable for scripting and embedding.

Expand Down
6 changes: 3 additions & 3 deletions crates/benchmarks/benches/fibonacci.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,10 @@ fn run_wasmi(wasm: &[u8], iterations: i32, name: &str) {

fn run_wasmer(wasm: &[u8], iterations: i32, name: &str) {
use wasmer::*;
let engine: Engine = wasmer::Singlepass::default().into();
let mut store = Store::default();
let compiler = wasmer::Singlepass::default();
let mut store = Store::new(compiler);
let import_object = imports! {};
let module = wasmer::Module::from_binary(&engine, wasm).expect("wasmer::Module::from_binary");
let module = wasmer::Module::from_binary(&store, wasm).expect("wasmer::Module::from_binary");
let instance = Instance::new(&mut store, &module, &import_object).expect("Instance::new");
let fib = instance.exports.get_typed_function::<i32, i32>(&store, name).expect("get_function");
fib.call(&mut store, iterations).expect("call");
Expand Down
2 changes: 1 addition & 1 deletion crates/parser/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ repository.workspace=true

[dependencies]
# fork of wasmparser with no_std support, see https://github.com/bytecodealliance/wasmtime/issues/3495
wasmparser={version="0.200.2", package="tinywasm-wasmparser", default-features=false}
wasmparser={version="0.200.3", package="tinywasm-wasmparser", default-features=false}
log={version="0.4", optional=true}
tinywasm-types={version="0.4.0", path="../types", default-features=false}

Expand Down
2 changes: 1 addition & 1 deletion crates/parser/src/conversion.rs
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,7 @@ pub(crate) fn convert_valtype(valtype: &wasmparser::ValType) -> ValType {
}

pub(crate) fn convert_memarg(memarg: wasmparser::MemArg) -> MemoryArg {
MemoryArg { offset: memarg.offset, align: memarg.align, align_max: memarg.max_align, mem_addr: memarg.memory }
MemoryArg { offset: memarg.offset, mem_addr: memarg.memory }
}

pub(crate) fn process_const_operators(ops: OperatorsReader<'_>) -> Result<ConstInstruction> {
Expand Down
1 change: 0 additions & 1 deletion crates/parser/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
#![forbid(unsafe_code)]
#![cfg_attr(not(feature = "std"), feature(error_in_core))]
//! See [`tinywasm`](https://docs.rs/tinywasm) for documentation.
#![recursion_limit = "1028"]

mod std;
extern crate alloc;
Expand Down
Loading