ConfigsApr 14, 2026·3 min read

Million.js — Make React 70% Faster with a Compiler-Driven Virtual DOM

Million.js compiles React components into an optimized block-based virtual DOM. By analyzing your JSX at build time, it avoids unnecessary diffs and delivers up to 70% faster renders on list-heavy UIs — with zero changes to most components.

TL;DR
Million.js compiles React components into a block-based virtual DOM for up to 70% faster renders.
§01

What it is

Million.js is a compiler that optimizes React components by replacing the standard virtual DOM diffing with a block-based approach. It analyzes your JSX at build time, identifies static and dynamic parts, and generates code that skips unnecessary diffs. The result is up to 70% faster renders on list-heavy UIs with zero changes to most components.

React developers working on data-intensive dashboards, large tables, and list-heavy interfaces benefit most from Million.js. It plugs into existing React projects as a compiler plugin without requiring you to rewrite components.

§02

How it saves time or tokens

Million.js is a build-time optimization that requires no runtime overhead and no code changes for most components. You add it as a plugin to your bundler configuration, and it automatically optimizes eligible components. This saves engineering time that would otherwise go into manual performance tuning, memoization, and virtualization.

§03

How to use

  1. Install Million.js and the compiler plugin for your bundler (Vite, Next.js, or webpack).
  2. Add the plugin to your build configuration.
  3. Optionally annotate performance-critical components with the block() higher-order function for maximum optimization.
§04

Example

npm install million
// vite.config.js
import million from 'million/compiler';
import react from '@vitejs/plugin-react';

export default {
  plugins: [million.vite({ auto: true }), react()]
};
// Automatic optimization - no code changes needed
function UserList({ users }) {
  return (
    <ul>
      {users.map(user => (
        <li key={user.id}>{user.name} - {user.role}</li>
      ))}
    </ul>
  );
}
// Million.js automatically optimizes this at build time
§05

Related on TokRepo

§06

Common pitfalls

  • Expecting Million.js to optimize components with heavy side effects or non-deterministic rendering patterns.
  • Using the block() HOC on components that already use React.memo without understanding how they interact.
  • Assuming all components benefit equally. Million.js provides the biggest gains on list rendering and data-grid components.

Frequently Asked Questions

Does Million.js work with Next.js?+

Yes. Million.js provides a Next.js plugin that integrates with the build pipeline. You add it to next.config.js and it optimizes eligible components during the build process.

Do I need to rewrite my React components?+

No. With auto mode enabled, Million.js analyzes and optimizes components at build time without code changes. You can optionally use the block() function to manually mark components for maximum optimization.

How does the block-based virtual DOM work?+

Instead of diffing the entire component tree on every render, Million.js identifies static parts of your JSX at compile time and only tracks the dynamic expressions. On re-render, it updates only the changed values directly in the DOM.

Is Million.js production-ready?+

Yes. Million.js is used in production React applications. The compiler generates standard JavaScript that works with React's reconciler, so it is compatible with React DevTools and existing testing infrastructure.

What is the performance improvement?+

Performance gains depend on your component structure. List-heavy components and data grids see the largest improvements, with benchmarks showing up to 70% faster renders. Simple components with few dynamic parts see smaller gains.

Citations (3)

Discussion

Sign in to join the discussion.
No comments yet. Be the first to share your thoughts.

Related Assets