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

@threeforged/instancing-optimizer

v0.1.1

Published

Optimize Three.js scenes by converting repeated meshes to instanced rendering

Readme

@threeforged/instancing-optimizer

Detect instancing opportunities in Three.js scenes. Analyzes GLB, GLTF, and OBJ files to find repeated meshes that can be converted to InstancedMesh, dramatically reducing draw calls. Reports candidates with confidence levels, estimated savings, and cross-file detection.

Installation

# 1. Install the ThreeForged CLI (one-time setup)
npm install -g @threeforged/cli

# 2. Install the instancing optimizer plugin in your project
npm install --save-dev @threeforged/instancing-optimizer

# 3. Detect instancing opportunities
threeforged instancing ./models/

CLI Usage

Requires @threeforged/cli:

# Analyze a single file
threeforged instancing model.glb

# Analyze a directory of assets
threeforged instancing ./models/

# JSON output
threeforged instancing ./scene.glb --json

# Save to file
threeforged instancing ./assets -o report.txt

Output

The optimizer produces a report with:

  • Summary — total meshes, draw calls, unique geometries, reuse ratio, candidate counts, estimated savings
  • Candidates table — per-group breakdown with geometry signature, instance count, draw calls saved, VRAM saved, and confidence level
  • Candidate details — mesh names, source files, and confidence reasons
  • Warnings — animation exclusions, material compatibility, cross-file opportunities, severity-weighted savings

Confidence Levels

Each candidate group is assigned a confidence level based on heuristics:

| Level | Meaning | |---|---| | HIGH | Identical geometry, no animations, compatible materials | | MEDIUM | Some animations present or high material diversity (but name patterns match) | | LOW | High animation density or heterogeneous materials with no name pattern |

Rules

| Rule | Description | |---|---| | geometry-grouping | Groups meshes by vertices:triangles:indexed signature | | animation-exclusion | Adjusts confidence based on animation channel density | | material-compatibility | Checks material-to-mesh ratio and mesh name prefix patterns | | savings-estimation | Calculates draw call and VRAM savings with severity thresholds | | cross-file-detection | Flags candidates spanning multiple files |

Programmatic API

import { detectInstancingCandidates } from '@threeforged/instancing-optimizer';

const report = await detectInstancingCandidates('./assets');

console.log(report.candidates);  // InstancingCandidate[]
console.log(report.metrics);     // InstancingMetrics
console.log(report.warnings);    // Warning[]

Configuration

Add an instancingOptimizer section to threeforged.config.js:

export default {
  instancingOptimizer: {
    instancingMinCount: 3,           // Minimum meshes to suggest instancing
    maxGroups: 20,                   // Maximum candidate groups to report
    maxEntriesPerGroup: 8,           // Maximum mesh entries shown per group
    minTrianglesPerMesh: 10,         // Ignore trivial geometry
    maxFiles: 500,                   // File scan limit (hard cap: 10,000)
    materialHeterogeneityThreshold: 0.5,  // Material-to-mesh ratio threshold (0, 1]
  },
};

License

MIT