What does HackerNews think of surplus?

High performance JSX web views for S.js applications

Language: JavaScript

Has anyone checked out the linked framework benchmark[0], and some of the other frameworks linked in there? I had not heard of surplus and S.js before, but they look like an interesting combo[1][2].

Their reasoning for why surplus uses real dom nodes seems pretty solid[3]. My oversimplified TL;DR: a virtual DOM mainly solves the problem of JavaScript not being reactive; the DOM already is. So if you have an efficient general solution for adding reactivity to JS, the need for a virtual DOM is reduced as well, and removing it then saves on the performance / complexity / interop overhead that it would add.

And S.js looks like pretty sweet reactivity library, even without surplus - lots of fine-grained control options too.

[0] https://github.com/krausest/js-framework-benchmark

[1] https://github.com/adamhaile/surplus

[2] https://github.com/adamhaile/S

[3] https://github.com/adamhaile/surplus#why-real-dom-nodes

> Moreover, it shows how you basically need to re-implement Virtual DOM and other tricks in vanilla JS code to approach the same speed.

Surplus [1] is the fastest in most benchmarks, and it doesn't use a virtual DOM.

[1] https://github.com/adamhaile/surplus

Surplus [1] is the fastest framework in the big JS benchmark challenge, and it too uses the native DOM directly rather than a virtual DOM. Looking forward to seeing Radi.js added to that benchmark suite to really put it to the test.

[1] https://github.com/adamhaile/surplus

> I’m really not an expert in web dev, but it _feels_ like web dev has been badly engineered.

It is, but it's getting better because so many different approaches have been tried that some of the more scalable and maintainable ones have been worked out. Also, (thank heavens) browser support is a lot more consistent now.

> I need to build a website soon and I’m dreading the front end.

If you're a software developer, I recommend some atomic/functional CSS toolkit, like Tachyons. That will free you from having to do probably 90% of the CSS work you used to have to do, and it matches a more programmer-type mindset to styling elements.

I'm building a site now, and so far it I've just needed to define some style classes for the colours, and the rest of the styling is already included out of the box via their reusable classes.

For the JS side, really depends what sort of dynamism you're looking for. You can go with a tiny JS library for polyfilling and standardizing browser behaviour [1] if you're just doing simple DOM manipulations, or if you expect to be doing a lot of AJAX with dynamic rendering, go with something like Surplus [2], or Vue, React or Mithril if you want something more standard.

[1] https://github.com/naasking/PithyDOM

[2] https://github.com/adamhaile/surplus

Just throwing my side project, Surplus, out there as another example of this strategy (https://github.com/adamhaile/surplus). Surplus compiles JSX into optimized code that produces real DOM elements. The combination of an ahead-of-time compiler plus no virtual DOM layer means that the runtime code only has to do the minimal, truly dynamic work.

As a result, Surplus is the fastest framework in Stefan Krauss's latest js-framework-benchmark (http://www.stefankrause.net/wp/?p=431).

DSLs are powerful, compiler support can make them fast.