DEV Community

Discussion on: Introducing the SolidJS UI Library

Collapse
 
ryansolid profile image
Ryan Carniato • Edited

Thank you for taking the time to respond. I don't think that in general raw speed is very noticeable in typical cases on typical systems. There has been a decent amount of talk about bundle sizes and low power devices, and even there 10-20kb is only a couple hundred milliseconds. So what difference is it that say Solid renders a 5000 dom elements on a page 50ms faster than React on a Core I7. Sure it's more like 300ms on my Core I5 laptop. Realistically you are only going to notice this on initial load. And then maybe not. What's the difference between 1.4 seconds and 1.7 seconds perceptually? Almost nothing. In the Realworld Demo the gap between Solid and React Redux, the slowest library I tested, was only about 800ms on resource loading under 3G simulation and CPU throttling. Mind you TTI(Time to Interactive) differed upwards of 4 seconds.

Performance is an easy metric, only easier one is kb weight. I started working on Solid because I liked fine grained reactivity as found in libraries like KnockoutJS which had these patterns a decade ago. When I saw React basically copy it with React Hooks (and the Vue crowd finally acknowledge they had these primitives all along), I knew it was a good time to start promoting the approach as IMHO it is much better at doing very similar things by any metric. I created a library DOM Expressions to allow any reactive library(MobX, KnockoutJS, among others) benefit from my work but continued to develop Solid as the pinnacle of this approach.

So while I acknowledge leading with performance sort of cheapens it I hope that if anyone spends the time to look at Solid will see that we have a very well designed and thoughtful approach to effectively build user interfaces.

Collapse
 
prateekprshrnith profile image
PRATEEK PRASHER

I really appreciate your work. Thank you.

Thread Thread
 
trusktr profile image
Joe Pea

It may be the best library to use if you want to make a declarative first-person shooter, where performance really matters if you want the best graphics and gameplay mechanics. :D

Thread Thread
 
devinrhode2 profile image
Devin Rhode

Svelte seems quite interested in smooth animations, I think that plays into Solid quite well too. I wonder how animations would be best written in solid and how that compares to other frameworks and their popular animation libraries.

Funny enough, I think Solid+Dart could steal some thunder from Flutter. Flutter is just gross, but, Dart is pretty nice TBH. Unfortunately there is the compiler aspect here, so it wouldn't be easy, but at some point any framework needs some answer to Native apps, in some way. NativeScript is interesting but Dart's VM is like WOW amazing. But then you inevitably see Flutter code and I just see all the horrors of Angular+OOP all over again.

Thread Thread
 
ryansolid profile image
Ryan Carniato

I was looking at NativeScript a little. Only my JSX is compiled so it's a matter of figuring out how to best output NativeScript from it. But.. yeah I haven't dug deep at all. If people are interested I'm sure things will go there. I've been a web first guy myself mostly (although I've created and supported a React Native app). I was secretly hoping PWAs would gain more ground quickly by the time I needed to worry about this. But doesn't quite seem like it.

Animations is a place I will need to do more work. Svelte has figured out how to compile it into the template. I can do some similar stuff here but I have less explicit hooks. Svelte basically constructs a minimal lifecycle based components that it uses to anchor different stages of a components life. Solid doesn't really acknowledge components exist and relies on the scheduling of the reactive system. So far I've created solid-transition-group which basically copies React or Vue's equivalent. I've done a few other simple demos with animations but as you can imagine they work today very similar to how they'd work in React or Vue. Using state changes to drive CSS or Web Animations or what ever library you want to use. It definitely isn't as packaged in as Svelte.

Thread Thread
 
devinrhode2 profile image
Devin Rhode

I actually don't know all that much about how Svelte does animations, only that animating in svelte was nice. I think mimicking the age old transition-group is great, since it's easier to migrate from react (idk what else people use for animating in react, again, not super well researched on animation libs).

Any thoughts on Dart in general? I've been envision TypeScript as a bridge to Dart, to be honest. I guess I don't know how to gradually convert a codebase to Dart, but my sense is that once you are comfortable with typescript, if you see the Flutter/Dart demo's, it's quite an appealing option over TypeScript. "Add these types, with a syntax built into the language, and get all these extra benefits of faster experience everywhere (super fast hot reloading, AOT compilation, etc)"

It'd be really great to be able to use Flutter Components inside a theoretical Solid.dart, but there might need to be a Flutter-Solid connecting thing akin to react-redux. I'd imagine that any level of HOC-ish Flutter component would be a no-go, however, since the semantics of updating the UI begin to clash (not sure how hard it would be to bridge the two, but surely it's possible in some way)

Thread Thread
 
devinrhode2 profile image
Devin Rhode

Dart even avoids any locks during garbage collection, which is amazing. As cool as concurrent mode is, Dart might make concurrent mode/suspense/etc a minor 1% improvement once the performance improvements from Dart are accounted for. Who knows. Just a fanboy.

Thread Thread
 
ryansolid profile image
Ryan Carniato

To be fair I don't really consider CM a thing for raw performance. Unless you are maxing your CPU cycles scheduling is going to be slower for the raw performance. I think of it more of having a distributed way to model possible futures, without trying to coordinate everything directly in the parent.

 
ryansolid profile image
Ryan Carniato

I honestly haven't had much of an opportunity/reason to look at Dart. TypeScript admittedly was mostly just a pragmatic choice since it seemed like a reasonable thing to do as a library author. It wasn't because of any personal like of TypeScript.

To be fair while the reactivity is a big part of what I do with Solid, my focus on the web came from knowing I could make a tangible difference there. Even SSR wasn't a place I was expecting have such success. I'm not sure how Solid would fit into Dart/Flutter ecosystem as it feels like they already have a good thing going.

Thread Thread
 
devinrhode2 profile image
Devin Rhode

I have fanboy'd over dart/flutter, google's presentations on dart/flutter show some amazing tech, but I think Dart is really the star of the show. I look at Flutter code and it's all the horrors of angular all over again.

What I really want is actually-native level performance (AOT compiled dart), great dev experience (dart dev compiler, ddc), BUT in a react/component/jsx paradigm.

Thread Thread
 
trusktr profile image
Joe Pea

Solid gives you that for sure. Also @lume/element gives you one more level higher: custom elements with templating powered by Solid.

I'm also planning to implement JSX for AssemblyScript unless someone else gets to it first, and the compile the implementations of my custom elements to WebAssembly.

The big milestone will be when we can also compile to native (run outside of the browser too, but with a web-first API that is easy for existing web developers).