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

warp-drive-express

v1.0.0

Published

A simple yet powerful Node.js and Express.js middleware to offload CPU-intensive tasks to the GPU, boosting performance for parallel computations. Ideal for machine learning, data analysis, and scientific computing applications.

Readme

warp-drive-express

NPM version

A simple yet powerful Node.js and Express.js middleware to offload CPU-intensive tasks to the GPU, boosting performance for parallel computations. Ideal for machine learning, data analysis, and scientific computing applications.

This middleware acts as a drop-in solution that prefers the GPU over the CPU for heavy computations, with a graceful fallback to the CPU when a GPU context is not available. It uses the powerful gpu.js library to perform GPGPU (General-Purpose computing on Graphics Processing Units).

Why use warp-drive-express?

  • Performance Boost: Drastically speed up parallelizable tasks by leveraging the massive parallel processing power of modern GPUs.
  • Easy Integration: A simple-to-use Express.js middleware that can be added to any existing application.
  • Graceful Fallback: Automatically falls back to CPU execution if a GPU is not available, ensuring your application runs anywhere.
  • Extensible: Register your own custom GPU and CPU kernels to tailor the middleware to your specific needs.

Quickstart Usage

  1. Install the package:

    npm install warp-drive-express
  2. Add the middleware to your Express.js application:

    const express = require('express');
    const { createWarpDriveExpress } = require('warp-drive-express');
    
    const app = express();
    
    // Add the middleware
    app.use(createWarpDriveExpress());
    
    // Your routes can now access the GPU kernels via req.warpDrive
    app.get('/my-computation', (req, res) => {
      const { matmul } = req.warpDrive.kernels;
      const result = matmul([1, 2], [3, 4]); // This will run on the GPU if available
      res.json(result);
    });
    
    app.listen(3000, () => {
      console.log('Server running on port 3000');
    });

Quick Example Usage

Here's an example of a route that calculates the Mandelbrot set, a computationally intensive task, using the warp-drive-express middleware.

app.get('/mandelbrot', (req, res) => {
  const { mandelbrot } = req.warpDrive.kernels;
  const { w = 200, h = 200, iter = 100 } = req.query;

  // The 'auto' mode will try to use the GPU first, and fallback to CPU
  const result = mandelbrot(parseInt(w), parseInt(h), parseInt(iter), 'auto');

  res.send(result); // The result will be an image buffer
});

Demo Server

For a more comprehensive set of examples and benchmarks, please see the demo server available on our GitHub repository. The demo server includes examples for:

  • Mandelbrot set generation
  • Matrix multiplication
  • An A/B test to compare CPU vs. GPU performance

SEO Keywords

Node.js GPU acceleration, Express.js GPU middleware, gpu.js express example, force GPU usage in Node.js, offload CPU to GPU Node.js, parallel computing Node.js, high performance computing Node.js, speed up Node.js server with GPU.