5 ms·
Kobold, a new web UI crate with zero-cost static DOM
- idiomaticrust 4y agoI sense some leptos inspirations ;)
- bilekas 4y agoActually a bit of the opposite, there doesn't appear to be any idea of state here and obviously no vDOM. In fact he mentions this at the end : > It is entirely feasible to implement React-esque hooks like in Yew or Dioxus as a 3rd-party crate. Looks like leptos could actually enhance this idea of `View`.
- eatonphil 4y agoLeptos is mentioned in the article: > Kobold does not have a concept of a stateful component. The view rendering part is relatively unopinionated about state management. It is entirely feasible to implement React-esque hooks like in Yew or Dioxus as a 3rd-party crate. Reactive signals like in Sycamore or Leptops should also interact nicely with the View trait.
- illiarian 4y agoSpeaking of "dreaded diffing". It's now fashionable to bash React and VDOM and diffing, but... vdom libs are at the forefront of performance these days: https://twitter.com/RyanCarniato/status/1636120238638137344?s=20 https://twitter.com/RyanCarniato/status/1636120238638137344?... You need either granular reactivity or diffing (or perhaps both), or else your framework's performance will easily be trash
- eviks 4y agoit seems that it's the manually manipulated ones that are at the forefront... > I need to look closer. It does appear that the Millions implementation will get flagged as manual manipulation. So that might get changed to one a bit slower. I can't imagine anyone writing this code
- illiarian 4y agoThere's also ivi and dioxus
- localvoid 4y agoThere was a bug in ivi 2.0.0 with `shouldComponentUpdate` optimization, it was completely ignored. This benchmark submission rerenders and diffs everything on each change, all other `f(state) => UI` libraries in this benchmark are implemented with `shouldComponentUpdate` optimization. Also, unlike majority of libraries on the left side of the table, ivi doesn't use any type of event delegation(implicit or explicit) to get better results, just plain old `addEventListener()` is used internally to attach event listeners.
- danielheath 4y agoHonestly I was expecting preact to fare much worse given what you wrote. Those numbers aren’t _the best_, but given the improvement in TTI from only needing 3kb of framework that seems like a pretty good tradeoff.
- sgt 4y agoVery cool. I'd actually like to see something like this for Go as well due to the insanely fast compile times. Compiling into wasm of course.
- ChikkaChiChi 4y agohttps://wails.io/ https://wails.io/ is a good starting point for Go.
- sgt 4y agoNot wasm though. More like a Rails for Go. Not a bad idea.
- spankalee 4y agoOnly diffing data and not static portions of templates is exactly what lit-html does too: https://lit.dev/docs/templates/overview/ https://lit.dev/docs/templates/overview/
- kabes 4y agoIsn't diffing of data exactly what angularjs (v1) used to do until that fell out of favor?
- chrsjxn 4y agoI am very curious about "zero-cost" here? Is this some standard technical term in the rust space?
- steveklabnik 4y agoIt’s a term borrowed from C++, a “zero cost abstraction.” Some folks use “zero overhead abstraction” to try and make the concept a bit more clear, since everything has some cost somewhere. “Zero cost” can feel incorrect.
- chrsjxn 4y agoThat makes more sense. Thanks! Creating and adding DOM nodes is definitely not free, but I can see how this is very low overhead compared to VDOM diffing.
- steveklabnik 4y agoNo problem. Here's the primary source, by the way: https://isocpp.org/wiki/faq/big-picture#zero-overhead-principle https://isocpp.org/wiki/faq/big-picture#zero-overhead-princi... > What you don’t use, you don’t pay for (in time or space) and further: What you do use, you couldn’t hand code any better.
- boredumb 4y agoYes. It's highlighted a lot in rust to mean zero cost abstraction. Basically adding language features without a run time penalty.
- twic 4y agoThe term comes from C++, where it does have a fairly rigorous definition: https://en.cppreference.com/w/cpp/language/Zero-overhead_principle https://en.cppreference.com/w/cpp/language/Zero-overhead_pri... Although: https://www.youtube.com/watch?v=rHIkrotSwcc https://www.youtube.com/watch?v=rHIkrotSwcc I'm not sure whether Rust people consistently use it with precisely the same sense.
- dmonitor 4y agoAs a certified kobold enthusiast, I don’t like the hideous creature they chose as their logo. I like cute kobolds more than… whatever that is.
- officeplant 4y agoSo many cute kobolds out there.
- rob74 4y agoBlame Gary Gygax for coming up with the strange concept that kobolds are these weird reptilian creatures. I like "traditional" kobolds (https://en.wikipedia.org/wiki/Kobold https://en.wikipedia.org/wiki/Kobold) more. The cutest is probably this one: https://en.wikipedia.org/wiki/Meister_Eder_und_sein_Pumuckl#Pumuckl https://en.wikipedia.org/wiki/Meister_Eder_und_sein_Pumuckl#... - mind you, I wouldn't trust him to handle my UI either, but at least I wouldn't have to worry that he wants to chew my face off...
- musicale 4y agoYears of cobalt mining mutated them into tiny, terrifying monsters.
- officeplant 4y agoEven so we got some nice furry kobolds out of japan and the furry/scalie community has done some things with the cold blooded kobolds...
- vgel 4y agoI think that kobold is cute!
- xiphias2 4y agoIt's easy to compare and be better than yew, it just has network effects going for it. Sycamore is much closer to that 0 cost Rust frontend framework, but has gone through many improvements.