Live data from Hacker News

Show HN: Moon – fast 7k Vue alternative

github.com

11–20 of 200 posts

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

#11

You say it's faster than Vue, but how much, how did you measure?

Moon is a part of js-framework-benchmark[1] (in the non-keyed results), and it performs faster than Vue there. The article I wrote a while back also has some benchmarks[2]. Finally, the overview section of the documentation also has benchmarks[3].

[1] https://rawgit.com/krausest/js-framework-benchmark/master/we...

[2] https://hackernoon.com/introducing-moon-1d44a99635f0

[3] http://moonjs.ga/docs/overview.html

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

#12
post #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

FWIW, I'm having extreme troubles reading the docs at http://moonjs.ga/docs/overview.html. The text is almost the same as the background for me.

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

#15
post #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 fo…

> There is really no way to avoid GC when you have a virtual DOM.

If you keep the virtual DOM in a typed array, there is not need for relying on the JavaScript garbage collection.

Here's an example:

https://github.com/vandenoever/baredom/blob/master/src/bared...

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

#16
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?

if(virtual_node.type == static){do stuff;} Super easy.

So developers mark it manually?

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

#19
post #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 fo…

Thanks, that makes a lot of sense. It sounds like the compiler is providing most of the benefit. Agreed about GC. It's a significant portion of time in Asana for large task lists.

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

#20
post #15
post #6

Earlier quoted context omitted.

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 fo…

> There is really no way to avoid GC when you have a virtual DOM. If you keep the virtual DOM in a typed array, there is not need for relying on the JavaScript garbage collection. Here's an example: https://github.com/vandenoever/baredom/blob/master/src/bared...

Thanks, I'll have to check this out!
Post reply on HN