frontend-js-performance

Identify and eliminate JavaScript performance bottlenecks in front-end code.

Updated Mar 8, 2026
One-click install
npx skills add https://github.com/adrian729/skills --skill frontend-js-performance
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: frontend-js-performance
Source: https://github.com/adrian729/skills/tree/main/.claude/skills/frontend-js-performance
Command: npx skills add https://github.com/adrian729/skills --skill frontend-js-performance

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Many front-end JavaScript codebases suffer from avoidable runtime slowdowns caused by layout thrashing, repeated O(n) lookups, unnecessary array iterations, expensive synchronous storage reads, and repeated RegExp or function allocations. This Skill distills practical patterns to detect and prevent these common performance pitfalls so UI interactions feel snappy and resource usage stays low.

Core Features & Use Cases

  • Batch DOM reads/writes to avoid forced synchronous reflows and reduce layout thrashing in interactive components.
  • Index Maps and Sets for O(1) repeated lookups instead of repeated find/includes operations.
  • Caching strategies for function results and storage API reads, with examples for cookie and localStorage synchronization and invalidation.
  • Loop and iteration optimizations including combining multiple passes, early returns, and O(n) min/max scans instead of sorting.
  • RegExp hoisting and immutability practices and guidance on using immutable array helpers like toSorted to avoid React bugs.
  • Use Case: Improve rendering and event-handling performance in a React app by batching style changes, replacing repeated array searches with Maps, and caching localStorage reads.

Quick Start

Ask the skill to analyze a front-end file and recommend concrete changes to eliminate layout thrashing, replace repeated lookups with Maps/Sets, cache expensive calls, and reduce unnecessary array iterations.

Frequently Asked Questions about frontend-js-performance

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I fix layout thrashing and speed up DOM performance in JavaScript?

Fix layout thrashing by batching DOM reads and writes to avoid forced synchronous reflows. Group all style reads first, then apply writes, so the browser recalculates layout once instead of repeatedly during interactive component updates.

What is the best way to optimize repeated array lookups in front-end JavaScript?

Optimize repeated array lookups by replacing find and includes operations with Maps and Sets for O(1) access. Indexing data into a Map eliminates unnecessary iterations and significantly reduces runtime cost in hot paths.

Does creating RegExp objects inside loops slow down JavaScript performance?

Creating RegExp objects inside loops slows down JavaScript performance by triggering repeated allocations. Hoist RegExp declarations outside loops to compile patterns once, achieving immutability and reducing garbage collection overhead.

How do I minimize array iterations when processing data in React components?

Minimize array iterations by combining multiple passes into single loops, using early returns, and performing O(n) min/max scans instead of sorting. Use immutable helpers like toSorted to prevent React rendering bugs while optimizing data processing.