Live data from Hacker News

Show HN: Moon – fast 7k Vue alternative

github.com

21–30 of 200 posts

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

#21
post #8

Earlier quoted context omitted.

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.

Sorry about that! I just updated the font-weight and colors. There should be more contrast now.

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

#23
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…

Is there a fundamental reason that Vue couldn't take the same approach?

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

#24

So far, the Infinite monkey theorem is just giving us an infinite number of javascript frameworks, and no Shakespeare

Honestly, I think libraries are great, if they improve on existing solutions and actually bring something new. Don't try and stop innovation just for the sake of having to make less decisions.

Moon's purpose is to provide an API similar to Vue, while being less than half of the size, and having improved performance in most cases. Why try and stop something new without giving any valid criticism? If we all have a mindset like this, the web isn't going to ever improve.

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

#25
post #24

So far, the Infinite monkey theorem is just giving us an infinite number of javascript frameworks, and no Shakespeare

Honestly, I think libraries are great, if they improve on existing solutions and actually bring something new. Don't try and stop innovation just for the sake of having to make less decisions. Moon's purpose is to provide an API similar to Vue, while being less than half of the size, and having improved performance in most cases. Why try and stop something new without giving any valid criticism? If we all have a mind…

Hey it's just a joke, take it easy. I didn't mean to discourage the work of OP in any way.

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

#26
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…

Is there a fundamental reason that Vue couldn't take the same approach?

Yes, and that is because Vue uses hyperscript. This allows you to use JSX, but at the same time makes a render function slower. Since Moon's virtual DOM syntax is stricter, it allows for the compiler to make lots of optimizations.

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

#28
post #22

So far, the Infinite monkey theorem is just giving us an infinite number of javascript frameworks, and no Shakespeare

Truly, in the JS world, it is the best of times, it is the blurst of times...

That's Dickens, not Shakespeare! Your monkeys are going in the wrong direction.

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

#29
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...

This is really cool! I'll definitely look into this and apply some of it to Moon.

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

#30
post #24

So far, the Infinite monkey theorem is just giving us an infinite number of javascript frameworks, and no Shakespeare

Honestly, I think libraries are great, if they improve on existing solutions and actually bring something new. Don't try and stop innovation just for the sake of having to make less decisions. Moon's purpose is to provide an API similar to Vue, while being less than half of the size, and having improved performance in most cases. Why try and stop something new without giving any valid criticism? If we all have a mind…

I guess that's where a bit of "static type" would make it easier. Different framework could explicitely back themselves against an API. With js, it's all implicit.
Post reply on HN