If you're interesting in a reactive template library that doesn't require a compiler for non-standard JavaScript syntax, check out a library I've been working on for a little while now, lit-html: https://github.com/Polymer/lit-html
> Nearly identical. lit-html uses `<template>`s and cloning, so that it doesn't have to do any expensive VDOM diffs.
So… it's not doing reconciliations and is just replacing the entire tree on every render, losing things like cursor position and forcing the browser to re-render and re-layout the entire thing?
Template strings loses all the actual benefits of JSX, in that you can have your editor parse it for validity and type hinting in the same way as if it was all createClass class (but more convenient).
Then you need to send lit-html over to the client also. This would be a great alternative if one doesn't already use Babel, but what's the selling point otherwise? Is there an easy way to combine lit-html's render with the HyperApp one?
Hyperapp is not optimized to be the fastest framework at the expense of worse developer experience. Having said that, we're definitely working on improving our runtime performance (see https://github.com/hyperapp/hyperapp/issues/499). So much to do!
I want to point out that while these benchmarks are very useful to detect underlying, potentially serious runtime and memory performance issues in your algorithm/framework, the implicit idea that even the slowest framework according to this list (e.g. choo) is a poor choice or inadequate for frontend development is ridiculous (the js-framework-bench creates > 80,000 nodes).
Please don't do that to your users, regardless of the framework you are using. Even the most complex user interface will have < 10,000 nodes. Tables/grids may get you there faster, however.
Still, in the case of Hyperapp we're talking about 100 to 200 milliseconds slower in the worst test (i.e., partial update) for a worst-case scenario.
This is an old benchmark, we're in the same ballpark as React now. Hyperapp is also not just a virtual DOM, but also a state management "all-in-one" kind of thing.
I don't even get why it is important that it's 1kb. Give me a library with great API and easy to use. Nobody cares if library is 1kb or 100kb (minified).
Some of those results refer to HyperTerminal, the Electron-based terminal app. Other results refer to Hyperapp-like libraries (not Hyperapp). The most recent submission related to Hyperapp was 8 months ago and Hyperapp has come a long way since then.
Here is another angle to this: go into React type of submissions and ask them to stop spamming HN with that?
I love hyperapp! As someone who thinks Elm’s architecture is ideal for building webapps, it’s great to be able to almost replicate it in JS. It’s simple enough to get started quickly but still robust enough to build actual apps and not just toys.
Is there any particular reason why? I’m curious because it’s my general understanding that creating a document fragment and attaching your vnodes to that and then pushing to the dom is more efficient especially for diffing
I'd disagree. React is very much a "Shakespeare" of javascript frameworks. It has solved UI dev by making even the most complex types of UIs predictably programmable. (Note: not including redux in this, which no developer who owns their time would use)
Side question: Isn't it grossly inefficient that in Redux, you have reducers that return an entirely new state object? Wouldn't it be better to return some kind of data that represents just the diff you intend to make, like {op: INCREMENT, arg: 1, key: "Foo"}?
[+] [-] spankalee|7 years ago|reply
Where JSX would look like this:
The lit-html would be: Nearly identical. lit-html uses `<template>`s and cloning, so that it doesn't have to do any expensive VDOM diffs.[+] [-] masklinn|7 years ago|reply
So… it's not doing reconciliations and is just replacing the entire tree on every render, losing things like cursor position and forcing the browser to re-render and re-layout the entire thing?
[+] [-] localvoid|7 years ago|reply
I am wondering, how is it possible that such non-expensive algorithm is more expensive than many VDOM libraries in this benchmark[1] ?
1. https://rawgit.com/krausest/js-framework-benchmark/master/we...
[+] [-] ricardobeat|7 years ago|reply
Same principle, different implementation, takes advantage of special string literal properties to achieve impressive speeds.
[+] [-] crooked-v|7 years ago|reply
[+] [-] plexicle|7 years ago|reply
[+] [-] gyrgtyn|7 years ago|reply
choo https://choo.io/ uses tagged templates too.
It's 4kilobytes.
[+] [-] grrowl|7 years ago|reply
[+] [-] JustSomeNobody|7 years ago|reply
Wait, I thought VDOMs were supposed to be fast(er).
Note: I'm not a FE Dev, so I'm only going by stuff I (think I) read, not write.
[+] [-] malydok|7 years ago|reply
[+] [-] always_good|7 years ago|reply
Or is there tooling that works for the tagged template approach?
[+] [-] hellcow|7 years ago|reply
My company's been using it in production for more than a year now without any issues. Highly recommend giving it a look.
[+] [-] pault|7 years ago|reply
[+] [-] agumonkey|7 years ago|reply
[+] [-] owlfarm|7 years ago|reply
[+] [-] starbuzz|7 years ago|reply
I want to point out that while these benchmarks are very useful to detect underlying, potentially serious runtime and memory performance issues in your algorithm/framework, the implicit idea that even the slowest framework according to this list (e.g. choo) is a poor choice or inadequate for frontend development is ridiculous (the js-framework-bench creates > 80,000 nodes).
Please don't do that to your users, regardless of the framework you are using. Even the most complex user interface will have < 10,000 nodes. Tables/grids may get you there faster, however.
Still, in the case of Hyperapp we're talking about 100 to 200 milliseconds slower in the worst test (i.e., partial update) for a worst-case scenario.
[+] [-] starbuzz|7 years ago|reply
[+] [-] gandreani|7 years ago|reply
[+] [-] ricardobeat|7 years ago|reply
[+] [-] ninjaturtles|7 years ago|reply
https://hn.algolia.com/?query=hyperapp&sort=byPopularity&pre...
[+] [-] romanovcode|7 years ago|reply
[+] [-] starbuzz|7 years ago|reply
Here is another angle to this: go into React type of submissions and ask them to stop spamming HN with that?
https://hn.algolia.com/?query=react&sort=byPopularity&prefix...
[+] [-] gandreani|7 years ago|reply
I love these little JS frameworks :)
https://mithril.js.org/
[+] [-] dsego|7 years ago|reply
[+] [-] soapdog|7 years ago|reply
[+] [-] Karupan|7 years ago|reply
[+] [-] fouc|7 years ago|reply
[+] [-] mmanfrin|7 years ago|reply
[+] [-] starbuzz|7 years ago|reply
[+] [-] coldcode|7 years ago|reply
[+] [-] gramstrong|7 years ago|reply
[+] [-] dereke|7 years ago|reply
React has a massive API for what is something essentially quite simple.
Personally my favourite "alternative" rendering library is hyperdom. Fast, simple and just gets the job done.
https://github.com/featurist/hyperdom/
[+] [-] matte_black|7 years ago|reply
[+] [-] czechdeveloper|7 years ago|reply
[+] [-] starbuzz|7 years ago|reply
[+] [-] no_wizard|7 years ago|reply
https://github.com/hyperhype/hyperscript
Question: I was looking over the source and noted that you weren’t building your virtual dom with the document fragment API https://developer.mozilla.org/en-US/docs/Web/API/DocumentFra...
Is there any particular reason why? I’m curious because it’s my general understanding that creating a document fragment and attaching your vnodes to that and then pushing to the dom is more efficient especially for diffing
[+] [-] oron|7 years ago|reply
[+] [-] sAbakumoff|7 years ago|reply
[+] [-] Vinnl|7 years ago|reply
[+] [-] kapv89|7 years ago|reply
[+] [-] starbuzz|7 years ago|reply
Not even funny IMO. This is the kind of toxic comment that don't motivate progress in this community.
[+] [-] devmunchies|7 years ago|reply
[+] [-] starbuzz|7 years ago|reply
Hyperapp is basically Elm in JavaScript.
[+] [-] curiousreacter|7 years ago|reply
[+] [-] vtange|7 years ago|reply
This seems smaller in footprint, but does it also win in runtime performance and stability?
[+] [-] c0brac0bra|7 years ago|reply
[+] [-] janci|7 years ago|reply
[+] [-] niksmac|7 years ago|reply
[+] [-] supercarsw|7 years ago|reply
[deleted]
[+] [-] unknown|7 years ago|reply
[deleted]