Live data from Hacker News

Show HN: Moon – fast 7k Vue alternative

github.com

1–10 of 200 posts

Re: Show HN: Moon – fast 7k Vue alternative

#6
post #3

How does Moon automatically detect static virtual nodes? What makes Moon faster than the alternatives? Finally, how does Moon avoid GC pressure with large trees?

The compiler treats everything as static by default. When the compiler detects something dynamic (such as a {{mustache}} template), it will mark the current node as dynamic, and the parent node as well.

These propagate up the tree so Moon eventually has a render function that is extremely optimized and can skip everything static, and the diff will only hit the nodes that can change.

Moon also has a stricter syntax for virtual DOM, allowing for less checks to be made at runtime compared to alternatives like HyperScript. This is made possible because Moon's compiler itself is in charge of creating the render functions, allowing it to give certain hints to the virtual DOM diffing engine.

There is really no way to avoid GC when you have a virtual DOM. The virtual DOM trees are pretty light and have memory usage similar to that of React and Inferno.

Re: Show HN: Moon – fast 7k Vue alternative

#8

Nice work! What did you use for building the documentation ?

Thanks! I created a static site generator called Sold [1]. The Moon configuration for Sold is available at the gh-pages branch [2].

[1] https://github.com/kbrsh/sold

[2] https://github.com/kbrsh/moon/tree/gh-pages

Post reply on HN