arcgis-performance
Skill1 starsChanged 6 months agoMITView on GitHub
Optimize ArcGIS Maps SDK for JavaScript 5.1 apps: tear views down with view.destroy() (and know it destroys the map and layers too), avoid high-frequency watches, draw less with scale ranges, feature reduction and visibility toggles, and keep bundle expectations honest (the SDK already code-splits itself). Use this skill whenever the user reports a slow map, a large bundle, jank while panning, lost WebGL contexts, or memory growth over time.
1 other project uses a version of this.
Adopted by
Most recently taken up by
- GeoDaoyu/arcgis-maps-sdk-js-ai-contexttheir own version, first seen Nov 8, 2026
Other versions1 project uses a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 1
- GeoDaoyu/arcgis-maps-sdk-js-ai-context★ 0same name
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository73 other files it gives its agents.
- skills/arcgis-3d-layers/AGENTS.mdAGENTS.md
- skills/arcgis-advanced-layers/AGENTS.mdAGENTS.md
- skills/arcgis-ai-components/AGENTS.mdAGENTS.md
- skills/arcgis-arcade/AGENTS.mdAGENTS.md
- skills/arcgis-authentication/AGENTS.mdAGENTS.md
- skills/arcgis-charts/AGENTS.mdAGENTS.md
- skills/arcgis-cim-symbols/AGENTS.mdAGENTS.md
- skills/arcgis-coding-components/AGENTS.mdAGENTS.md
- skills/arcgis-coordinates-projection/AGENTS.mdAGENTS.md
- skills/arcgis-core-maps/AGENTS.mdAGENTS.md
- skills/arcgis-core-utilities/AGENTS.mdAGENTS.md
- skills/arcgis-custom-rendering/AGENTS.mdAGENTS.md
- skills/arcgis-editing/AGENTS.mdAGENTS.md
- skills/arcgis-embeddable-maps/AGENTS.mdAGENTS.md
- skills/arcgis-feature-effects/AGENTS.mdAGENTS.md
- skills/arcgis-geometry-operations/AGENTS.mdAGENTS.md
- skills/arcgis-imagery/AGENTS.mdAGENTS.md
- skills/arcgis-interaction/AGENTS.mdAGENTS.md
- skills/arcgis-knowledge-graphs/AGENTS.mdAGENTS.md
- skills/arcgis-layers/AGENTS.mdAGENTS.md
- skills/arcgis-map-tools/AGENTS.mdAGENTS.md
- skills/arcgis-parquet/AGENTS.mdAGENTS.md
- skills/arcgis-performance/AGENTS.mdAGENTS.md
- skills/arcgis-popup-templates/AGENTS.mdAGENTS.md
- skills/arcgis-portal-content/AGENTS.mdAGENTS.md
- skills/arcgis-rest-services/AGENTS.mdAGENTS.md
- skills/arcgis-scene-environment/AGENTS.mdAGENTS.md
- skills/arcgis-smart-mapping/AGENTS.mdAGENTS.md
- skills/arcgis-spatial-analysis/AGENTS.mdAGENTS.md
- skills/arcgis-starter-app/AGENTS.mdAGENTS.md
- skills/arcgis-tables-forms/AGENTS.mdAGENTS.md
- skills/arcgis-time-animation/AGENTS.mdAGENTS.md
- skills/arcgis-utility-networks/AGENTS.mdAGENTS.md
- skills/arcgis-visualization/AGENTS.mdAGENTS.md
- skills/arcgis-widgets-advanced/AGENTS.mdAGENTS.md
- skills/arcgis-widgets-ui/AGENTS.mdAGENTS.md
- skills/hello-world/AGENTS.mdAGENTS.md
- arcgis-3d-layersSkill
- arcgis-advanced-layersSkill
- arcgis-ai-componentsSkill
- arcgis-arcadeSkill
- arcgis-authenticationSkill
- arcgis-chartsSkill
- arcgis-cim-symbolsSkill
- arcgis-coding-componentsSkill
- arcgis-coordinates-projectionSkill
- arcgis-core-mapsSkill
- arcgis-core-utilitiesSkill
- arcgis-custom-renderingSkill
- arcgis-editingSkill
- arcgis-embeddable-mapsSkill
- arcgis-feature-effectsSkill
- arcgis-geometry-operationsSkill
- arcgis-imagerySkill
- arcgis-interactionSkill
- arcgis-knowledge-graphsSkill
- arcgis-layersSkill
- arcgis-map-toolsSkill
- arcgis-parquetSkill
- arcgis-popup-templatesSkill
- The first 60 shown.
The file
We split this skill into the rules it gives an agent
3 rules. About 0 are common, 0 are distinctive, and 3 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈0
Distinctive · estimate
This author's own choices. Worth a look.
3
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 69
Import per module (@arcgis/core/<path>.js, only the components you render).
- Very specific: line 103
Remove your watch/on handles too.
- Very specific: line 118
Use import() for optional features, but don't expect it to fix a slow first load.
≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Performance
When to use: Activate this skill whenever the user reports a slow map, a large bundle, jank while panning/zooming, or memory growth, and wants concrete optimizations.
Overview
Performance in the SDK comes from three levers: clean up, draw less, and ship less code. Measured with 5.1.27, the first two matter far more than the third.
- Problem it solves: lost WebGL contexts, leaks in long-lived SPAs, jank while panning, slow loads.
- Who it serves: developers tuning a working app for production.
- Pattern it teaches: deterministic teardown, settled-state watches, scale ranges and reduction, granular imports.
- What it does NOT cover: the initial setup (see
arcgis-starter-app) or rendering choices (arcgis-visualization).
Quick Start
// Route teardown in an SPA that reuses the same map across routes.
function leaveRoute(view: MapView, handles: { remove(): void }[]) {
handles.forEach((h) => h.remove());
view.map = null; // keep the map and its layers alive for the next view
view.destroy(); // frees the WebGL context
}Measured: creating 20 MapViews and only clearing the container left all 20 alive; Chromium logged "Too many active
WebGL contexts. Oldest context will be lost." and 4 views ended with fatalError. With destroy(), none did.
Decision Tree
- Lost WebGL contexts or memory growth across navigations?
- Yes →
view.destroy()on unmount; setview.map = nullfirst if the map is reused.
- Yes →
- Jank while panning or zooming?
- Work on every frame → watch
view.stationary, notview.center/view.extent. - Too many features →
minScale/maxScale,featureReduction(cluster or binning),definitionExpression. - Toggling layers →
layer.visible, not remove-and-recreate.
- Work on every frame → watch
- Initial bundle too big?
- Import per module (
@arcgis/core/<path>.js, only the components you render). import()optional features, knowing the SDK already lazy-loads most of its own code.
- Import per module (
Default: destroy views, watch settled state, scale-limit detail layers.
Import Patterns
Direct ESM (recommended for npm/Vite/Webpack)
import FeatureLayer from "@arcgis/core/layers/FeatureLayer.js";
import * as reactiveUtils from "@arcgis/core/core/reactiveUtils.js";Dynamic Imports (CDN)
const FeatureLayer = await $arcgis.import("@arcgis/core/layers/FeatureLayer.js");Map Components (recommended for new projects)
// Import only the components you render.
import "@arcgis/map-components/components/arcgis-map";Key Concepts
Concept 1: Teardown, and what destroy() takes with it
view.destroy() frees the view's WebGL context. It also destroys its map and every layer in it (measured:
map.destroyed === true, layer.destroyed === true, map.layers.length === 0). If the map outlives the view
(tabs, routes, a shared store), set view.map = null before destroying: measured, the map survived with its layers.
Remove your watch/on handles too.
Concept 2: Draw less
minScale/maxScale suspend a layer outside its range (measured: at country scale, a minScale: 50000 layer view
had suspended: true and fetched nothing). featureReduction aggregates dense points (a plain
{ type: "cluster" } autocasts to FeatureReductionCluster). Toggling layer.visible keeps the layer: measured, 3
toggles made 0 requests to the service, while 3 remove-and-recreate cycles made 24.
Concept 3: Bundle expectations
There is no root module: import * from "@arcgis/core" and "@arcgis/core/layers" do not resolve (TS2307), so
those "barrel" mistakes fail the build rather than bloat it. The SDK already splits itself: a Vite build of
Map + MapView + FeatureLayer produced 748 chunks with a 1494 KB (430 KB gzip) initial chunk. Moving CSVLayer
and KMLLayer behind import() saved only 24 KB (6 KB gzip) of initial code (tests/bundle/medir.mjs).
Use import() for optional features, but don't expect it to fix a slow first load.
Common Pitfalls (Top 3)
Pitfall 1: Leaving views alive
// ❌ Anti-pattern
function leaveRoute() { container.innerHTML = ""; } // the view and its WebGL context stay alive// ✅ Correct
function leaveRoute() { view.destroy(); }Impact: measured with 20 views: all stayed alive, Chromium dropped the oldest WebGL contexts ("Too many active
WebGL contexts") and 4 views hit fatalError. With destroy(): 0.
Pitfall 2: destroy() on a view whose map you still need
// ❌ Anti-pattern
view.destroy();
newView.map = sharedMap; // sharedMap was destroyed with the old view, layers and all// ✅ Correct
view.map = null;
view.destroy();
newView.map = sharedMap;Impact: measured: after view.destroy(), map.destroyed and layer.destroyed were true and the map had 0
layers; the next view shows an empty map.
Pitfall 3: Recomputing on every frame of a pan
// ❌ Anti-pattern
reactiveUtils.watch(() => view.center, () => expensiveRecompute());// ✅ Correct
reactiveUtils.watch(() => view.stationary, (stationary) => { if (stationary) expensiveRecompute(); });Impact: measured during one 1.5 s goTo: the center watch fired 92 times, the stationary one once.
When to Read references/
| If you need... | Read |
| Perf-related properties/APIs | references/api-detail.md |
| Bundle, clustering, cleanup examples | references/examples.md |
| More pitfalls (5+ extended) | references/pitfalls.md |
Related Skills
arcgis-starter-app— set up the build firstarcgis-core-utilities— handle cleanup patternsarcgis-visualization— feature reduction and renderers
Reference Samples
Changelog
- 0.2.0 (2026-10-27): SDK 5.1. Measured in
tests/runtime/casos/arcgis-performance.tsandtests/bundle/medir.mjs. The old pitfall 1 (import * from "@arcgis/core") and its barrel twin do not resolve at all, so they cannot "balloon the bundle"; the Quick Start'simport()saved 24 KB of a 1494 KB initial chunk because the SDK already splits into ~748 chunks. New top pitfalls with numbers: views left alive (4 of 20 lost their WebGL context),view.destroy()destroying a shared map and its layers, andwatch(center)(92 fires vs 1). - 0.1.0 (2026-05-31): Initial release.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

