Closed ccorcos closed 1 year ago
FYI, the code of the compiler located here: https://github.com/aidenybai/million/tree/main/packages/vite-plugin-million
Hi @ccorcos, thanks for your interest in Million and happy to answer your questions.
I'm seeing the diff code here, but that looks like its happening at runtime? 🤷♂️
Million is a Virtual DOM, there is a runtime component for diffing, alongside a compiler.
The documentation says all I have to do is npm install million to get started but there doesn't appear to be a build step necessary to do any compilation... When / where does the compiling happen?
The compilation happens with the vite plugin, per @SukkaW's comment.
As for the performance benchmarks, you say its faster than React, but React isn't in your benchmark for comparison...
I assume you're referring to the Tweet. The test made in the benchmark was measuring the time it takes to add 5000 nodes in succession (for loop). On the left, it shows the time it takes to diff and patch the nodes. On the right, it shows delta compute and dom application.
The benchmark itself is only to compare to other Virtual DOM libraries. We are exploring comparisons between libraries with #37
Ah ok. Thanks for the reply.
So regarding the compiler, what exactly is the optimization here? It looks like it's unwrapping components into one large single component? Is that what's going on? I'm also curious how this handles hooks in subcomponents.
I assume you're referring to the Tweet. The test made in the benchmark was measuring the time it takes to add 5000 nodes in succession (for loop). On the left, it shows the time it takes to diff and patch the nodes. On the right, it shows delta compute and dom application.
Ah, so that tweet has nothing to do with the compiler, right? That's just useList
which keeps track of list mutations via Proxy and passes those deltas on to the component?
Still trying to figure out how the deltas bypass the diffing mechanism though... somewhere in here?
Thanks,
Chet
So regarding the compiler, what exactly is the optimization here? It looks like it's unwrapping components into one large single component? Is that what's going on? I'm also curious how this handles hooks in subcomponents.
The current optimization renders hyperscript calls to flattened vnode objects, similar to how inferno does it. More optimizations to come.
Ah, so that tweet has nothing to do with the compiler, right? That's just useList which keeps track of list mutations via Proxy and passes those deltas on to the component?
Yes, that's correct. The Tweet has nothing to do with it and it's benchmarking useList
Still trying to figure out how the deltas bypass the diffing mechanism though... somewhere in here?
The delta logic occurs in src/drivers/use-children.ts
closed via v2
I'm trying to understand how this library works and I'm seeing "compiler" mentioned all over the place. However, when I look through the code, I don't see a compiler anywhere.
From your paper: https://arxiv.org/pdf/2202.08409v1.pdf
I'm seeing the diff code here, but that looks like its happening at runtime? 🤷♂️ https://github.com/aidenybai/million/blob/392b07a86ceb87e5aa4181b57bcbb705f34b27b5/packages/million/render.ts#L29
From your website:
The documentation says all I have to do is
npm install million
to get started but there doesn't appear to be a build step necessary to do any compilation... When / where does the compiling happen?As for the performance benchmarks, you say its faster than React, but React isn't in your benchmark for comparison...
Maybe consider using the list of popular virtual dom libraries in the Preact benchmark comparison.
Thanks for the help!