-
QUESTION: I wonder how it compares, because I saw that right now preact and react have signals support which may be trivial to implement, but preact says that it weighs 3kb, so taking this to account, what would you say is the best choice right now |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments
-
Issues with React, and inherently with Preact, like stale closures, unnescessary reruns, are not solved by the use of Signals. React is still the obvious choice, if you want to build a end-user product based on well known tools and patterns. The alternatives only matters in advanced scenario's, typically if you are building a generic library. It is also a tradeoff of risks that highly depends on your use case.
|
Beta Was this translation helpful? Give feedback.
-
Now, is signals support trivial? absolutely not! signals and observables share the same complexity when it comes to change detection and propagation, scheduling, etc..... And are signals purely for performance? also no, observable pattern could be faster, proven by this benchmark. The truth is, the performance of this implementation does not come from the fact that it is based on observable pattern, but rather because the amazing graph algorithm that helps achieve this performance. To proof my point, I started building Signals on top of this graph algorithm and soon I will send my contribution to |
Beta Was this translation helpful? Give feedback.
-
I've succesfully used xania in a large scale project, currently the core of xania rendering engine is stable since dec 2022. It needs some refactoring and cleanup but any additional work won't involve changes in the structure / behavior of the engine. Today, when xania is compared to solid then solid clearly wins because of established solutions like ui libraries, routing, ssr story. In the long run the feature set won't be the differentiator of interest, eventually xania will be able to catch up. if we ignore the feature set then, simply put, there are three main differences between xania and solid,
1. state: observables vs signalsOn the surface there is (soon) not much difference when it comes to the use of signals in both xania or solid. 2. Component as templatesThe expression // xania
const template = <Button />
render([template, template], target) // wil render two elements
// solid
const element = <Button />
render([element, element], target) // wil render one element, that's why solid instead uses call back to render elements
render(()=> <Button />, target); 3. No need for a compilerXania depends on out of the shelf compiler of typescript. The same concept as React: Solid on the other hand, when used with JSX, then a solid's own compiler is needed to translate to normal javascript. Using the power of a compiler sounds tempting to generate highly optimized code from declarative JSX, but, thanks to krausest benchmark where xania is the absolute fastest (excluding the ones that are not playing a fair game), we can conclude that that is not the case. Don't get me wrong, solid is blazingly fast, difference with xania is neglitable to be a deciding factor between the two. const a = 1;
const b = 2;
const c = 3;
function slow(x: number) {
return (a + b + c) * x;
}
function fast(x: number) {
return 6 * x;
} The functions So why is it important whether or not a compiler is used?A compiler must have higher maintenace cost resulting in slower progress and innovation going forward. Integrations will be generally more complex (takes more effort and time) because of the use of the compiler. I belief integration with Bun is such an example. |
Beta Was this translation helpful? Give feedback.
I've succesfully used xania in a large scale project, currently the core of xania rendering engine is stable since dec 2022. It needs some refactoring and cleanup but any additional work won't involve changes in the structure / behavior of the engine.
Today, when xania is compared to solid then solid clearly wins because of established solutions like ui libraries, routing, ssr story. In the long run the feature set won't be the differentiator of interest, eventually xania will be able to catch up.
Let me first state I am in no way entitled to have an opinion about solidjs. But I'll share my naive thoughs on solid anyway ;) please correct me if you see fit.
if we ignore the feature set the…