Gathering detailed insights and metrics for million
Gathering detailed insights and metrics for million
Gathering detailed insights and metrics for million
Gathering detailed insights and metrics for million
to-regex-range
Pass two numbers, get a regex-compatible source string for matching ranges. Validated against more than 2.78 million test assertions.
@million/lint
Make your React app fast
@million/install
An easy way to install @million/lint
piral-million
Plugin for integrating Million components in Piral.
npm install million
Typescript
Module System
Node Version
NPM Version
62.9
Supply Chain
97.9
Quality
86
Maintenance
100
Vulnerability
100
License
TypeScript (71.93%)
MDX (17.93%)
JavaScript (8.88%)
CSS (1.23%)
HTML (0.02%)
Total Downloads
1,913,136
Last Day
2,005
Last Week
19,835
Last Month
105,009
Last Year
1,463,224
16,673 Stars
2,363 Commits
584 Forks
62 Watching
71 Branches
128 Contributors
Latest Version
3.1.11
Package Id
million@3.1.11
Unpacked Size
840.03 kB
Size
205.66 kB
File Count
60
NPM Version
10.5.1
Node Version
22.0.0
Publised On
04 Jun 2024
Cumulative downloads
Total Downloads
Last day
-56.5%
2,005
Compared to previous day
Last week
-23.7%
19,835
Compared to previous week
Last month
-9.7%
105,009
Compared to previous month
Last year
327.9%
1,463,224
Compared to previous year
25
Want to automatically find and fix performance issues? Check out Million Lint.
Million.js is an extremely fast and lightweight optimizing compiler that make components up to 70% faster.
Oh man... Another
/virtual dom|javascript/gi
framework? I'm fine with React already, why do I need this?
Million.js works with React and makes reconciliation faster. By using a fine-tuned, optimized virtual DOM, Million.js reduces the overhead of diffing (try it out here)
TL;DR: Imagine React components running at the speed of raw JavaScript.
The Million.js CLI will automatically install the package and configure your project for you.
1npx million@latest
Once your down, just run your project and information should show up in your command line!
Having issues installing? → View the installation guide
To understand why to use Million.js, we need to understand how React updates interfaces. When an application's state or props change, React undergoes an update in two parts: rendering and reconciliation.
To show this, let's say this is our App
:
1function App() { 2 const [count, setCount] = useState(0); 3 const increment = () => setCount(count + 1); 4 return ( 5 <div> 6 <p>Count: {count}</p> 7 <button onClick={increment}>Increment</button> 8 </div> 9 ); 10}
In this App
, when I click on the button, the count
state will update and the <p>
tag will update to reflect the new value. Let's break this down.
The first step is rendering. Rendering is the process of generating a snapshot of the current component. You can imagine it as simply "calling" the App
function and storing the output in a variable. This is what the App
snapshot would look like:
1const snapshot = App(); 2 3// snapshot = 4<div> 5 <p>Count: 1</p> 6 <button onClick={increment}>Increment</button> 7</div>;
In order to update the interface to reflect the new state, React needs to compare the previous snapshot to the new snapshot (called "diffing"). React's reconciler will go to each element in the previous snapshot and compare it to the new snapshot. If the element is the same, it will skip it. If the element is different, it will update it.
<div>
tag is the same, so it doesn't need to be updated. ✅
<p>
tag is the same, so it doesn't needs to be updated. ✅
<p>
tag is different, so it needs to be updated. ⚠ ️<button>
tag is the same, so it doesn't need to be updated. ✅
onClick
prop is the same, so it doesn't need to be updated. ✅<button>
tag is the same, so it doesn't need to be updated. ✅(total: 6 diff checks)
1<div> 2- <p>Count: 0</p> 3+ <p>Count: 1</p> 4 <button onClick={increment}>Increment</button> 5</div>
From here, we can see that the <p>
tag needs to be updated. React will then update the <p>
DOM node to reflect the new value.
1<p>.innerHTML = `Count: ${count}`;
React is slow.
The issue with React's reconciliation it becomes exponentially slower the more JSX elements you have. With this simple App
, it only needs to diff a few elements. In a real world React app, you can easily have hundreds of elements, slowing down interface updates.
Million.js solves this by skipping the diffing step entirely and directly updating the DOM node.
Here is a conceptual example of how Million.js reconciler works:
1function App() { 2 const [count, setCount] = useState(0); 3 const increment = () => setCount(count + 1); 4 5 // generated by compiler 6 if (count !== prevCount) { 7 <p>.innerHTML = `Count: ${count}`; 8 } 9 10 <button>.onclick = increment; 11 12 // ... 13}
Notice how when the count
is updated, Million.js will directly update the DOM node. Million.js turns React reconciliation from O(n)
(linear time) to O(1)
(constant time).
How fast is it? → View the benchmarks
Looking for the docs? Check the documentation or the Contributing Guide out. We also recommend reading Virtual DOM: Back in Block to learn more about Million.js's internals.
Want to talk to the community? Hop in our Discord and share your ideas and what you've build with Million.js.
Find a bug? Head over to our issue tracker and we'll do our best to help. We love pull requests, too!
We expect all Million.js contributors to abide by the terms of our Code of Conduct.
→ Start contributing on GitHub
This repo is a "mono-repo" with modules. Million.js ships as one NPM package, but has first class modules for more complex, but important extensions. Each module has its own folder in the /packages
directory.
You can also track our progress through our Roadmap.
Module | Description |
---|---|
million | The main Virtual DOM with all of Million.js's core. |
react / react-server | React compatibility for Million.js. |
compiler | The compiler for Million.js in React. |
jsx-runtime | A simple JSX runtime for Million.js core. |
types | Shared types between packages |
Million.js takes heavy inspiration from the following projects:
blockdom
(Géry Debongnie)
Thank you to Géry pioneering the concept of "blocks" in the virtual DOM. Many parts of the Million.js codebase either directly or indirectly derive from his work.voby
(Fabio Spampinato)
The Million.js "template" concept is derived from Voby's template()
API.react
and turbo
for their documentation. Many parts of the current Million.js documentation are grokked and modified from theirs.ivi
, Preact, and moreMillion.js is MIT-licensed open-source software by Aiden Bai and contributors:
No vulnerabilities found.
Reason
no dangerous workflow patterns detected
Reason
no binaries found in the repo
Reason
license file detected
Details
Reason
packaging workflow detected
Details
Reason
0 commit(s) and 10 issue activity found in the last 90 days -- score normalized to 8
Reason
Found 4/30 approved changesets -- score normalized to 1
Reason
detected GitHub workflow tokens with excessive permissions
Details
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
security policy file not detected
Details
Reason
project is not fuzzed
Details
Reason
branch protection not enabled on development/release branches
Details
Reason
dependency not pinned by hash detected -- score normalized to 0
Details
Reason
SAST tool is not run on all commits -- score normalized to 0
Details
Reason
32 existing vulnerabilities detected
Details
Score
Last Scanned on 2024-12-23
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More