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 🙏

© 2026 – Pkg Stats / Ryan Hefner

webgpu-profiler

v0.1.2

Published

Live GPU memory profiler for WebGPU. Patches GPUDevice once and gives you exact byte-level snapshots of every buffer and texture, plus an optional React HUD overlay.

Readme

webgpu-profiler

Live GPU memory profiler for WebGPU. One call patches the device, then every buffer and texture is tracked. Optional React HUD overlay.

The MemoryHUD overlay showing a live buffer and texture breakdown

npm install webgpu-profiler

Use

import { autoInstrument } from "webgpu-profiler";

// Once, at boot, before any renderer is created.
if (process.env.NODE_ENV !== "production") autoInstrument();
import { MemoryHUD } from "webgpu-profiler/react";

// Anywhere in your tree, dev-only:
{process.env.NODE_ENV !== "production" && <MemoryHUD />}

That's it. The HUD finds the active instrumentation automatically.

What it does

autoInstrument() patches GPUAdapter.prototype.requestDevice so any GPUDevice returned anywhere in the app gets its createBuffer and createTexture wrapped. Those are the only two WebGPU JS-side allocation entry points, so every buffer and texture is captured with its descriptor. The HUD polls a snapshot every second and shows a copyable breakdown.

API

| Symbol | Purpose | |---|---| | autoInstrument(options?) | Patch the adapter prototype to auto-instrument every new device. Returns a disposer. | | instrumentDevice(device) | Manually instrument a single device. Idempotent. Returns a DeviceInstrumentation handle. | | getActiveInstrumentation() | Read the most recently registered handle (null if none). | | subscribeActiveInstrumentation(cb) | Subscribe to changes in the active handle. | | profileMemory(inst) | Build a MemoryReport snapshot from a handle. | | reportToText(report) | Plain-text rendering for clipboard / bug reports. | | textureDescriptorBytes(desc) | Byte calc for a single GPUTextureDescriptor. | | resolveExtent(size) | Normalize a GPUExtent3D to { width, height, depth }. | | MemoryHUD (from /react) | Overlay component. All props optional. |

MemoryHUD props: instrumentation?, refreshMs? (1000), corner? ("top-right" / "top-left" / "bottom-right" / "bottom-left"), className?, style?.

Building your own UI

If you're not using React, getActiveInstrumentation() and subscribeActiveInstrumentation() let you react to instrumentation changes from any code:

import {
  getActiveInstrumentation,
  subscribeActiveInstrumentation,
  profileMemory,
} from "webgpu-profiler";

const unsubscribe = subscribeActiveInstrumentation(() => {
  const inst = getActiveInstrumentation();
  if (inst) console.log(profileMemory(inst));
});

What is not counted

  • Canvas swapchain backbuffer (created by context.configure(), not createTexture).
  • Driver-internal allocations: residency caches, MSAA backing, pipeline objects, bind group layouts, staging buffers that bypass the JS API. Always opaque to JS by design.

Compare against your browser's per-tab GPU memory readout (Chrome Shift+Esc, "GPU Memory" column) to see the residual gap, which is typically 5 to 15 percent.

Caveats

  • WebGPU only. WebGL's allocation model differs significantly and is not supported.
  • Depth-stencil formats (depth24plus, depth32float-stencil8, etc.) are reported as their JS-API minimums. Real driver footprint is often larger due to alignment and separate stencil planes.
  • ASTC bytes-per-pixel reflect the format's block size. Some implementations may pad differently.

License

MIT (c) Redmond Riddell