home / skills / harborgrid-justin / lexiflow-premium / react-compiler-optimization-profiles

react-compiler-optimization-profiles skill

/frontend/.github-skills/react-compiler-optimization-profiles

This skill helps you optimize React Compiler profiles by tuning memoization, reducing manual useMemo, and improving cold-start performance.

npx playbooks add skill harborgrid-justin/lexiflow-premium --skill react-compiler-optimization-profiles

Review the files below or copy the command above to add this skill to your agents.

Files (1)
SKILL.md
938 B
---
name: react-compiler-optimization-profiles
description: Deep dive into the React Compiler (formerly React Forget) to tune automatic memoization and optimization profiles.
---

# React Compiler Optimization Profiles

## Summary
Deep dive into the React Compiler (formerly React Forget) to tune automatic memoization and optimization profiles.

## Key Capabilities
- Analyze compiler output to verify memoization boundaries.
- Identify distinct optimization de-opt bailouts.
- Configure compiler passes for specific code patterns.

## PhD-Level Challenges
- Quantify the overhead of compiler-injected memoization slots.
- Construct cases where manual memoization outperforms the compiler.
- Analyze the impact of compiler optimizations on cold-start time.

## Acceptance Criteria
- Provide compilation reports for critical components.
- Demonstrate a reduction in manual `useMemo` usage.
- Document de-optimization triggers discovered.

Overview

This skill provides a focused toolkit for analyzing and tuning the React Compiler’s automatic memoization and optimization profiles. It helps teams validate memoization boundaries, surface de-optimization causes, and configure compiler passes to match real-world code patterns. The outcome is clearer optimization reports and fewer unnecessary manual memo calls.

How this skill works

The skill inspects compiler output and generated IR to identify where the compiler inserts memoization slots and optimization guards. It highlights distinct bailout reasons and correlates them with source patterns. It also offers configuration guidance to adjust compiler passes for targeted components and produces compilation reports for measurable changes.

When to use it

  • When you want to verify that the compiler’s automatic memoization aligns with intended component boundaries.
  • When tracking down unexpected de-optimizations or runtime bailouts introduced by compiler transforms.
  • When reducing manual useMemo/useCallback clutter and verifying the compiler safely replaces them.
  • When measuring cold-start impact or binary size changes from compiler-injected slots.
  • When tuning compiler pass ordering for app-specific coding idioms.

Best practices

  • Start by generating compilation reports for a small set of critical components before sweeping the codebase.
  • Correlate bailout reasons with minimized reproductions to avoid false positives.
  • Prefer iterating compiler pass tweaks on feature branches and measure against CI performance metrics.
  • Document discovered de-optimization triggers and share patterns with the team to improve source-level coding guidance.
  • Use targeted assertions to prove reductions in manual memo usage rather than broad heuristics.

Example use cases

  • Produce a per-component compilation report that shows memo slots and bailouts for a complex dashboard widget.
  • Demonstrate a 30–50% reduction in manual useMemo calls in a UI library by validating compiler-inserted memoization.
  • Create minimal repros for three distinct de-optimization triggers and propose compiler pass adjustments.
  • Measure cold-start time and initial bundle changes after enabling specific optimization passes for server-rendered pages.
  • Tune compiler heuristics to avoid memoization in hot-path list rendering and validate with benchmarked traces.

FAQ

Will this replace manual performance profiling?

No. This skill complements runtime profiling by inspecting compiler decisions and showing where compile-time hooks affect runtime behavior.

Do changes require rebuilding the whole app?

Compiler pass tweaks should be tested on targeted builds; full rebuilds are needed to validate global effects but start with focused components.

Can the compiler always eliminate manual useMemo?

Not always. The compiler can replace many patterns but some cases still benefit from explicit memoization; the skill helps quantify those cases.