- Home
- Skills
- Agents & Orchestration
- threejs optimization
threejs optimization
Optimize Three.js performance by reducing draw calls, fixing memory leaks, and compressing 3D assets with data-backed audits.
Free
Works with the AI Agents you already use
threejs optimization
Example session with this skill installed
The scene drops to 20 FPS when zooming into the city model. There are 2,500 draw calls and the JS heap keeps growing. Please optimize the runtime performance.
- Read your context and instructions
- Compiled the threejs optimization
I have analyzed the city model scene. The frame drops are primarily caused by excessive draw calls due to unique materials on every building and a memory leak in the interaction event listeners. I implemented geometry merging for static buildings and converted the event system to a centralized manager.
Optimization Report
| Metric | Condition | Baseline | Optimized | Change |
|---|---|---|---|---|
| Frame Time (p95) | 60 FPS target | 50.2 ms | 15.8 ms | -68.5% |
| Draw Calls | Static view | 2,540 | 122 | -95.2% |
| JS Heap | After 5 mins | 420 MB | 185 MB | -55.9% |
| Triangles | Zoomed out | 1.2M | 1.2M | 0% (Stable) |
Implementation Details
// Optimized building rendering using BatchedMesh to reduce draw calls
import { BatchedMesh, MeshStandardMaterial } from 'three';
const totalBuildings = 2500;
const geometry = buildingGeometry; // Shared geometry reference
const material = new MeshStandardMaterial({ color: 0xffffff });
const cityMesh = new BatchedMesh(totalBuildings, 100000, 200000, material);
buildingsData.forEach((data, i) => {
const id = cityMesh.addGeometry(geometry);
cityMesh.setMatrixAt(id, data.matrix);
cityMesh.setColorAt(id, data.color);
});
scene.add(cityMesh);
// Fix: Centralized interaction manager to prevent listener accumulation
function cleanupInteractions() {
window.removeEventListener('pointermove', onPointerMove);
// ... existing cleanup logic fixed
}
Next steps
- Review the
BatchedMeshimplementation insrc/world/City.js. - Run the
npm run benchcommand to verify these results on mobile hardware. - Verify that building-specific click interactions still trigger the correct metadata overlays.
Connects securely to your tools. The creator never sees your data.
About this skill
Heavy Three.js scenes often suffer from frame drops, memory leaks, and slow asset loading. This skill diagnoses and fixes performance bottlenecks across CPU execution, GPU rendering, and memory consumption. It provides an end-to-end workflow from baseline benchmarking to implementing specific code and asset optimizations.
What it does
- Runtime Profiling monitors frame intervals (p50/p95), CPU main thread usage, and GPU draw calls to identify lag sources.
- Memory Management tracks JS heap growth and VRAM usage to prevent crashes during scene transitions or long sessions.
- Asset Optimization compresses GLB/glTF models using mesh simplification, batching, and texture resizing while maintaining visual fidelity.
- Rendering Efficiency optimizes the render loop by managing resource ownership, loader compatibility, and multi-instance scenarios.
- Automated Validation performs regression testing to ensure animations, bones, and interactions remain intact after optimization.
How it works
- Establish Baseline by fixing test conditions like DPR, viewport size, and hardware to capture p95 frame times and JS heap metrics.
- Isolate Bottlenecks through variable-controlled testing to distinguish between CPU-bound logic, GPU-bound shaders, or loading overhead.
- Execute Improvements by applying non-destructive changes to the rendering loop, resource handling, or asset files.
- Verify and Report by re-testing the final combined build against initial benchmarks to quantify percentage gains.
Frameworks & tools
Specifically designed for Three.js applications. It utilizes browser profiling APIs, glTF transform tools, and standard performance monitoring metrics (FPS, Draw Calls, Triangle counts).
Why this beats prompting it yourself
Generic prompts often suggest destructive changes that break animations or scene hierarchy. This skill follows a strict "baseline, isolate, fix, re-test" protocol that ensures optimizations are backed by measurable data rather than guesswork.
Use cases
- Stabilizing frame rates in complex 3D configurators with high draw call counts.
- Reducing initial load times and memory spikes for mobile-web 3D experiences.
- Auditing and compressing large GLB assets for production-ready performance.
- Identifying and fixing memory leaks in long-running digital twin applications.
Known limitations
Requires a reproducible test environment or production build to capture runtime metrics. GPU timing may be unavailable depending on browser security settings or hardware constraints.
Requires reproducible test environments to capture runtime metrics. GPU timing depends on browser/hardware support. Static audits skip runtime-only metrics.
How to use
- 1
Connect your agent to the Agensi MCP
Copy the prompt and paste it into Claude, ChatGPT, Cursor or any agent that supports MCP. It sets up the connection for you. Manual setup
- 2
Sign in to Agensi
Your agent shows a sign-in link. Sign in and click Allow.
- 3
Ask for what you need
Your agent loads this skill and uses it on your task. It always asks before any payment.
Reviews
No reviews yet
Be one of the first to try it. Every listed skill goes through the trust checks below.
Security scanned
Checked by our 8-point scan before listing
Fresh listing
Recently published to Agensi
Free forever
No account required to browse
Trust & safety
Security scan
Security scan passed 8 days ago
- Free with an Agensi account
Permissions
No special permissions declared or detected