Earlier quoted context omitted.
You are right, I will have to investigate more. I don't know how much of react's virtual dom diff can you cram in 2.5kb though :)
Not much. The point is that such heavy diffing can be avoided if loops and conditionals are enough and if you don't need random HTML changes.
Riot – A React-like, 2.5K user interface library
51–60 of 222 posts
Re: Riot – A React-like, 2.5K user interface library
#52Earlier quoted context omitted.
You are right, I will have to investigate more. I don't know how much of react's virtual dom diff can you cram in 2.5kb though :)
Not much. The point is that such heavy diffing can be avoided if loops and conditionals are enough and if you don't need random HTML changes.
But in React you can arbitrarily change HTML because the render method returns a string to be compared to the earlier situation.
A tag name can change for example (which you rarely need).
Re: Riot – A React-like, 2.5K user interface library
#53I like the use of a virtual DOM and the custom tags. Custom tags is what makes Angular easy to use. But I would like to see some benchmarks. I'm afraid parsing every single byte of every single html template is slow. Riot also needs widgets. Lots of lots of widgets for material design widgets for making desktop and mobile apps, and twitter bootstrap like widgets. Good developers are lazy developers. They don't want t…
Benchmarks are definitely coming. In theory Riot is super fast. The DOM is parsed once when a tag is initialized and after that the text nodes and attributes are only updated if the expression results to a different value. The expressions are compiled and cached. Any performance bottleneck can be fixed.
Beware the way you're benchmarking, e.g. immutable structures and pure (& immutable-state-aware) components can make a pretty huge difference in react.
Re: Riot – A React-like, 2.5K user interface library
#54Earlier quoted context omitted.
Not much. The point is that such heavy diffing can be avoided if loops and conditionals are enough and if you don't need random HTML changes.
Exactly. Loops and conditionals should give you enough power. But in React you can arbitrarily change HTML because the render method returns a string to be compared to the earlier situation. A tag name can change for example (which you rarely need).
I'm pretty sure the render method returns a vdom node (which the library can then diff and merge into the actual DOM)
Re: Riot – A React-like, 2.5K user interface library
#55Re: Riot – A React-like, 2.5K user interface library
#56Great, another framework mixing concerns and doing custom HTML. What's wrong with React?
But we felt that what React does could be simplified. We didn't need full diffing and batching of HTML and we didn't like the verbosity on how components are created.
minimalism is where Riot starts from.
Re: Riot – A React-like, 2.5K user interface library
#57But, I would _really_ love to see some render time benchmarks with large (2K+) loops adding/removing deeply nested nodes. This is where React really shines in my opinion, and I'm struggling to believe that Riot can compare with the implementation described.
Re: Riot – A React-like, 2.5K user interface library
#58Earlier quoted context omitted.
Benchmarks are definitely coming. In theory Riot is super fast. The DOM is parsed once when a tag is initialized and after that the text nodes and attributes are only updated if the expression results to a different value. The expressions are compiled and cached. Any performance bottleneck can be fixed.
> Benchmarks are definitely coming. Beware the way you're benchmarking, e.g. immutable structures and pure (& immutable-state-aware) components can make a pretty huge difference in react.
Maybe I can just use the TodoMVC app.
Re: Riot – A React-like, 2.5K user interface library
#59Earlier quoted context omitted.
I agree that calling it "React-like" seems misleading. When I read about a 'x'-like library I expect something that could actually replace 'x' and provide nearly the same features. Pete Hunt did a great talk on what actually makes React / virtualdom different from other databinding approaches.[1] Using this definition Riot.js looks a lot more like Angular, Ember et al. to me. [1] https://www.youtube.com/watch?v=-DX3v…
Virtual DOM implementation is indeed different. The biggest reason for calling it "React-like" is the basic idea of components, where related HTML and JS are combined together. > "Build components, not templates" http://www.slideshare.net/floydophone/react-preso-v2 I think this is the "what" of React and virtual DOM is the "how".
The difference between React and other databinding methods is that you can use all JS language features (i.e. if, for, while, .filter(), .map(), libraries like Rx.js, etc.) when defining what you want your DOM to look like.
Suppose I want to have a list of items based on some array, which I want to filter based on some predicate, and display the items differently based on their content type.
In a React render() function I would just use
filter( (it) => { //some predicate } )
to filter unwanted items, and map((it) => { switch (it.contentType) { // cases } })
to map the individual items to how I want them to look like.To me it looks like to implement something like this in Riot would require to build / use something that is more like Angular's computed properties.
But I'd like to be proven wrong.