npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2025 – Pkg Stats / Ryan Hefner

zaw

v0.0.4

Published

Zero-allocation WebAssembly communication protocol

Downloads

15,650

Readme

zaw

Zero Allocation WASM @ Style Arcade

The purpose of zaw is to make it easier to achieve the original promise of WebAssembly:

High-performance, low-overhead acceleration for targeted code - without rewriting your entire application.

🎯 The upshot

With zaw, you'll be able to offload individual algorithms, rather than entire modules, and keep your WebAssembly code lean and simple - truly unlocking the original vision of the WebAssembly founding team.

🚀 Performance

Up to 7x faster than pure JavaScript and 2.5x faster than wasm-bindgen for XOR Int32Array Bench

| Element Count | Winner | vs zaw | vs js | vs wasm-bindgen | | ------------- | ------ | ----------- | ----------- | ----------------- | | 10 | js | 1.9x faster | - | 4.2x faster | | 100 | zaw | - | 1.4x faster | 2.2x faster | | 1,000 | zaw | - | 5.6x faster | 2.5x faster | | 10,000 | zaw | - | 7.1x faster | 2.3x faster | | 100,000 | zaw | - | 7.1x faster | 2.4x faster |

📦 Installation

npm install zaw

🔥 Quick Start

Here's how to sum an array of Float64s using zaw.

This won't actually be fast; check out the example implementations to see what this looks like with full SIMD & batching.

Host Implementation

Typescript
import { createInstance } from 'zaw'

// Low-level WASM API
type WasmExports = {
  sumFloat64Array: () => 0 | 1 // 0 = OK, 1 = Error
}

// High-level API with bindings
type WasmApi = {
  sumFloat64Array: (values: Float64Array) => number
}

export async function initWasmApi(wasmBuffer): Promise<WasmApi> {
  const instance = await createInstance<WasmExports>(wasmBuffer, {
    // Reserve 1kb for both input and output channels
    inputChannelSize: 1_000,
    outputChannelSize: 1_000,
  })

  return {
    sumFloat64Array: instance.bind(
      // The exported function to bind to
      instance.exports.sumFloat64Array,

      // Input binding: copy values into WASM (zero allocation)
      (input, values) => input.copyFloat64Array(values),

      // Output binding: read the sum from the output channel
      output => output.readFloat64(),
    ),
  }
}

// Load your WASM module
const api = await initWasmApi(wasmBuffer)
const numbers = new Float64Array([1.5, 2.3, 3.7, 4.1])
const sum = api.sumFloat64Array(numbers)
console.log('Sum:', sum) // 9.5

WASM Implementation

Zig
const zaw = @import("zaw");

const interop = zaw.interop;
const OK = interop.OK;

// Setup all required WASM interop exports
comptime {
    zaw.setupInterop();
}

export fn sumFloat64Array() i32 {
    var input = interop.getInput()       // Get shared input buffer
    var output = interop.getOutput()     // Get shared output buffer

    const values = input.readArray(f64)  // Read array from JS

    var total: f64 = 0
    for (values) |x| total += x  // Simple sum (in reality, use SIMD)

    output.write(f64, total)     // Write result back to JS
    return OK
}
Rust
use zaw::interop;
use zaw::interop::error::{Error, OK};

// Setup all required WASM interop exports
zaw::setup_interop!();

#[no_mangle]
pub extern "C" fn sumFloat64Array() -> i32 {
    let input = interop::get_input();     // Get shared input buffer
    let output = interop::get_output();   // Get shared output buffer

    let values = input.read_array_f64();  // Read array from JS

    let mut total = 0.0;
    for value in values {
        total += value;       // Simple sum (in reality, use SIMD)
    }

    output.write_f64(total);  // Write result back to JS

    return OK;
}

Error Handling

Zig
fn myFunction_inner() !void {
  // Your logic here
}

export fn myFunction() i32 {
  return Error.handle(myFunction_inner);
}
Rust
#[no_mangle]
pub extern "C" myFunction() -> i32 {
    fn inner() => Result<(), Error> {
      // Your logic here
    }

    // Will serialize error and return to host (or just return OK)
    interop::error::handle(inner)
}