News for hackers. Stuff that matters.
Re:Size of node_modules folder when installing the top 100 p... by pier25 on Thursday January 09, 2020 @06:22PM (#22006957)
I'm using Mithril on my current project and it includes everything you need in less than 10kB gzipped (vdom, components, router, http client).

Another huge benefit is that it simplifies you application code immensely. Your store and models are simply vanilla JS since Mithril doesn't have reactivity, observables, etc. Mithril will simply redraw all the vdom whenever a user event happens or when its router/http client do something. You can also call m.redraw() if you need the UI to update if you for example receive something from a web socket.

Obviously with this approach the performance cannot be as good as something like Svelte or Inferno, but it's significantly faster than React.

https://krausest.github.io/js-framework-benchmark/current.ht...

Personally I use it with JSX since I can't stand the hyperscript notation.

It's certainly not for everyone and all use cases but I think it's totally valid for a good portion of front end work if you can handle a double edged knife.

Re:Size of node_modules folder when installing the top 100 p... by voltagex_ on Thursday January 09, 2020 @10:17PM (#22008070)
>The benchmark was run on a Razer Blade 15 Advanced (i7-8750H, 32 GB RAM, Ubuntu 19.10 (Linux 5.3.0-24, mitigations=off), Chrome 79.0.3945.79 (64-bit))

i.e. one of the fastest consumer machines around. I wonder how much the web would be better if more people targetted a $300 laptop instead of a $3000 one. Or probably a $30 Android instead of a $1000 iPhone.

Re:Size of node_modules folder when installing the top 100 p... by pier25 on Thursday January 09, 2020 @10:43PM (#22008157)
Yeah but the point is comparing the frameworks among themselves.
Re:Size of node_modules folder when installing the top 100 p... by Aissen on Friday January 10, 2020 @08:10AM (#22010666)
Which results might be different on smaller machines than on bigger machines, which have different tradeoffs. Scalability isn't linear.
Re:Size of node_modules folder when installing the top 100 p... by pier25 on Friday January 10, 2020 @11:08AM (#22011921)
> Scalability isn't linear

Hmmm would be interesting to do the benchmarks on different machines and see if you are right.

Re:Size of node_modules folder when installing the top 100 p... by ezramorse on Thursday January 09, 2020 @09:35PM (#22007935)
Awesome until you look around and notice you’ve fallen into a pit of despair (tech debt) and have no ecosystem to leverage your way out of it or people you can hire that want anything to do with it :)

There needs to be concerns beyond pure speed and package size to dictate tools. Sometimes real world practical constraints must be considered

Re:Size of node_modules folder when installing the top 100 p... by brlewis on Friday January 10, 2020 @08:10AM (#22010662)
> you’ve fallen into a pit of despair (tech debt) and have no ecosystem to leverage your way out of it or people you can hire that want anything to do with it

It sounds like you're saying that the way out of tech debt is to install more 3rd-party packages and/or hire more people, I hope you meant something else.

I use and recommend React at work because of the hiring thing, but for my own personal projects I stick with Mithril. With JSX it's not hard to switch back and forth between the two, at least with TypeScript there to tell me when I accidentally use HTML in my React JSX, e.g. the class attribute when React wants the className property. (With Mithril you use attributes that map exactly to HTML attributes)

Re:Size of node_modules folder when installing the top 100 p... by pier25 on Thursday January 09, 2020 @10:41PM (#22008145)
You don't need much else besides Mithril and maybe a css library.

As for hiring I agree somewhat but anyone with a couple of years of front end experience should be able to pick it up in a matter of hours.

Re:Size of node_modules folder when installing the top 100 p... by jnwatson on Thursday January 09, 2020 @09:44PM (#22007961)
You’re saying people don’t want to work on vanilla JavaScript? Really?
Re:Size of node_modules folder when installing the top 100 p... by ezramorse on Friday January 10, 2020 @12:04AM (#22008447)
I’m saying check Mithril npm packages vs react/vue packages, contributed by the people who wanted to work with each framework. Some ecosystems have more work to pull from, more people active and experienced, and more established patterns & tools.
Re:Size of node_modules folder when installing the top 100 p... by dividuum on Friday January 10, 2020 @10:48AM (#22011768)
I've been very happy recently with using the Vue.js ecosystem with the standalone vue.js and a few others directly <script>'ed from my applications. Usually vue.js, vuex.js, vue-resource.js and maybe vue-router.js are all dependencies I'll have to add. This avoids the npm circus with the (from my point of view acceptable) downside of, for example, not having single file components. The advantage is a minimal set of dependencies of ~70kb compressed JS added in total and a community where most of the question I had are answered somewhere.
Re:Size of node_modules folder when installing the top 100 p... by nwmcsween on Friday January 10, 2020 @02:00PM (#22014010)
Eh, I wouldn't qualify technical debt as having less mind share. This is like saying code is worse because it's more concise and has less moving parts.
Re:Size of node_modules folder when installing the top 100 p... by rimliu on Friday January 10, 2020 @01:01AM (#22008678)
And then there is https://svelte.dev/ which does not even have vdom. And Rich Harris (the author) has pretty strong opinions about it. Check out his talks on YouTube, worth it.
Re:Size of node_modules folder when installing the top 100 p... by pier25 on Friday January 10, 2020 @11:16AM (#22011989)
Svelte has many great things going on. I have dabbled with it and will probably use it more seriously on my next project.

My only annoyance is that I've grown accustomed to making micro components with React, Inferno, and Mithril on the same file. Stuff like buttons and such. With Svelte (and Vue when using SFC) you need to create each component in its own file which becomes tedious for more complicated views.

Re:Size of node_modules folder when installing the top 100 p... by ezramorse on Friday January 10, 2020 @01:33AM (#22008801)
Sapper is worth a look for SSR folks

https://sapper.svelte.dev/

Re:Size of node_modules folder when installing the top 100 p... by baddox on Thursday January 09, 2020 @06:46PM (#22007110)
Unless there's more to the story than the redraw methods you described, I would suspect that this approach would not be significantly faster than React if your React components correctly use shouldComponentUpdate and React.memo.
Re:Size of node_modules folder when installing the top 100 p... by pier25 on Thursday January 09, 2020 @10:42PM (#22008153)
Right, except that in Mithril and other libs you don't need to do that to get similar or better performance.
Re:Size of node_modules folder when installing the top 100 p... by Aeolun on Friday January 10, 2020 @02:51AM (#22009200)
This seems odd. If this were the case then react with only functional components should be just as fast, but it isn’t.
Re:Size of node_modules folder when installing the top 100 p... by chocolatkey on Thursday January 09, 2020 @06:27PM (#22006999)
For people like me who like the hyperscript syntax, or have to use it, I've found this site very useful for converting existing HTML templates quicker https://arthurclemens.github.io/mithril-template-converter/i...
Re:Size of node_modules folder when installing the top 100 p... by loustak on Friday January 10, 2020 @07:03AM (#22010382)
Glad I see someone mentioning Mitrhil. I love it and start to have real world use cases such as Lichess.
Re:Size of node_modules folder when installing the top 100 p... by jahewson on Thursday January 09, 2020 @08:17PM (#22007648)
will simply redraw all the vdom whenever a user event happens

> that’s going to be painful when I want to filter a live search result page with more than a just few results.

Re:Size of node_modules folder when installing the top 100 p... by wruza on Thursday January 09, 2020 @08:43PM (#22007758)
Vdom is not dom. Mithril maintains a previous copy of vnodes (pojo) and only patches corresponding divs when new vnodes differ. Comparing and disposing pojo is cheap. Producing vnodes cheap too, unless you do heavy calculations at render, but that’s true for any framework.
Re:Size of node_modules folder when installing the top 100 p... by pier25 on Thursday January 09, 2020 @10:36PM (#22008128)
The vdom is not the dom.

I'm using it right now with a gallery of about 2000 items with filtering and search. No problem on an i5 desktop.

Re:Size of node_modules folder when installing the top 100 p... by Aeolun on Friday January 10, 2020 @02:53AM (#22009206)
Have you tried in IE11? I think that’s the true test of speed for any webapp now.
Re:Size of node_modules folder when installing the top 100 p... by ____hacker____ on Friday January 10, 2020 @02:09PM (#22014155)
Why would you do that in 2020?