I wish instead of this marketing article there were technical details, for example: what method of change tracking is used (proxies Vue-style or recomputing everything React-style).
Also I didn't understand the phrase about JS "overflowing stack" with 150 000 objects. I created a list of 150 000 objects with the following code:
var list = [];
for (var i = 0; i < 150000; i++) { list.push({ id: i, name: `Name ${i}`, weight: i * 100 }); }
According to profiler, this array (with objects) uses 14 Mb, where 2 Mb is array and the rest are objects and strings. Running list.find() without any indexes also doesn't overflow the stack. With indexes it would probably be lightning fast and won't need any WASM and complications.
JS is not that slow. And if you do numeric computations (i.e. multiplication of numbers in large arrays) the code gets compiled and runs pretty fast.
The author uses something like `list.push(...objects)` in his demo code, and I believe this is the culprit. Passing many (~100,000) arguments to a method at once using the spread operator is known to cause a stack overflow, because, in JavaScript, each argument is placed on the call stack.
Spreading arrays and objects is such a common performance hit. It works fine for small instances but falls over in large instances.
Here's the JS CRM engine https://github.com/nuejs/nue/blob/master/packages/examples/s... I see a number of issues, but don't have time to look into them. 1. Spreading when you probably don't need a copy: sortEntries. Sorting is probably where the overflow happens. Just sort in place or use Array.from or slice. 2. Excessive use of array functions. In my experience, a C style for loop performs better when you need performance. Create an empty array before, perform your business logic inside the block, and push to the array. 3. I don't know how filter is called, but it potentially loops through all of the events three times in the worst case. 4. paginate manually creates a JSON string from the returned entries. I don't know why, it seems inefficient.
Most new frameworks start as the "lightweight" option to whatever more mature options exist at the time. This is no argument for adoption.
Please post again 10 years from now after you have added all the bloat your users request and handled all the edge cases you don't yet understand. If you are still lighter than a react button...that will be news worthy.
JS frameworks have often valued DX first over what it outputs. Frontend devs also frequently care more about a) their own tooling and b) how it looks, to a much higher priority than the performance and stability of their output. At least from my own experience in the community :)
Oh my god, yes this is hitting the nail on the head in a way I hadn't thought before. The bloat comes from the discipline (or lack of) more than the framework.
IMO, those who have only worked in React tend to be unfamiliar with the layers of native capability that React is built upon, and so they are stuck in the React bubble unless they want to learn a ton of (admittedly crufty, but useful) web fundamentals.
So, nothing is worthy of discussion or can claim any benefits over the incumbents until it has become an incumbent itself? How is it supposed to attract the necessary users to get bloated if they can’t talk about it in relation to the established players?
All I am saying is that being lightweight, when you have been around for less time than a mature solution, is a mute point.
It's a cop out way to differentiate because you are clearly not comparing apples to apples. You have a fraction of the features and a fraction of the bug fixes. You are trying to make it sound like you are a 1:1 replacement, when you are not.
Solid.js is doing amazing w/re to its bundle size. Its been in development for something between 6-9 years depending on how you count and it is still very very slim.
- Why is the demo impressive https://mpa.nuejs.org/app/ I believe someone can do the same web-app in React with the same performance.
- I'd like to quickly see some code samples on the home page. I had to dig the documentation to find some code samples (https://nuejs.org/docs/view.html#clean-html-templating), is it inspired from Svelte ?
- How is new faster and lighter compared to other tech? Specifically, compared to raw HTML/js.
To convince me that Nue is a framework worse using, please show that Nue:
1. Is simpler than HTML+JS (or at least simpler than react): like https://alpinejs.dev/
2. Is easy to understand: maybe the markup and logic are close to HTML or something else I already know
3. Has a better DX with good build time and HMR: you nailed this one
4. The tech is better: low overhead? highly based on WASM? virtual DOM? Server islands?
5. Show me metrics: https://esbuild.github.io/ nailed this one
> Why is the demo impressive https://mpa.nuejs.org/app/ I believe someone can do the same web-app in React with the same performance
Weren't the main points on the main page that it was small ("lighter than a React button"), and could handle large amounts of records ("far past where JavaScript (and React) would crash with a stack overflow error")?
Those points are only true if you're comparing to a React app that uses bloated frameworks and inefficient list manipulation (as other commenters pointed out, `list.push(...items)` causes problems)
If the authors of this project mean to say that a button in react wouldn’t work without including the react library (which is why the button is supposed to be 73kb), it’s a weak point, because the react library would be reused by other parts of the app bundle at this point.
This is misleading to people and the promise is so shallow that it almost feels insulting.
I’m the author. To clarify: a button installed via ShadCN/Vite’s official docs (https://ui.shadcn.com/docs/installation/vite) ends up way heavier than a full Nue SPA. It’s not a jab at React devs—just showing how web standards can flip the script on bloat. Any thoughts on framing this comparison better?
Can you give some examples of some of these standards that make Nue stand out and other frameworks don't use? It seems that if other frameworks make use of these standards we would get a similar performance boost across the ecosystem.
Seems like it should be Meta with billon dollars that should be doing that. The whole point is framework like React are made for DX and dev flow at company of that size.
It's like someone making a hello world in C using the std, then one hand crafting the console print but losing literally everything else. Of course, if my goal was to just write hello world then it would make sense but 99.9% of people in the world will use something else, invalidating the point.
Mention that you know you are missing dozens of features instead of blaming it on “web standards” would definitely help frame it better. Do you think Vite doesn’t know about web standards? It reads pretty naively.
Also I recommend just not making a web framework. There are many of them, some very similar to Nue. Your effort could be placed on improving what is out there. I suspect that is a lot harder and less fun than just making something new. But if you manage to contribute then you’ll be helping an entire community of people whereas a new web framework will likely see almost no adoption before it is abandoned.
Comments (568) 81 threads
Earlier commentsAlso I didn't understand the phrase about JS "overflowing stack" with 150 000 objects. I created a list of 150 000 objects with the following code:
According to profiler, this array (with objects) uses 14 Mb, where 2 Mb is array and the rest are objects and strings. Running list.find() without any indexes also doesn't overflow the stack. With indexes it would probably be lightning fast and won't need any WASM and complications.JS is not that slow. And if you do numeric computations (i.e. multiplication of numbers in large arrays) the code gets compiled and runs pretty fast.
Here's the JS CRM engine https://github.com/nuejs/nue/blob/master/packages/examples/s...
I see a number of issues, but don't have time to look into them.
1. Spreading when you probably don't need a copy: sortEntries. Sorting is probably where the overflow happens. Just sort in place or use Array.from or slice.
2. Excessive use of array functions. In my experience, a C style for loop performs better when you need performance. Create an empty array before, perform your business logic inside the block, and push to the array.
3. I don't know how filter is called, but it potentially loops through all of the events three times in the worst case.
4. paginate manually creates a JSON string from the returned entries. I don't know why, it seems inefficient.
Please post again 10 years from now after you have added all the bloat your users request and handled all the edge cases you don't yet understand.
If you are still lighter than a react button...that will be news worthy.
IMO, those who have only worked in React tend to be unfamiliar with the layers of native capability that React is built upon, and so they are stuck in the React bubble unless they want to learn a ton of (admittedly crufty, but useful) web fundamentals.
It's a cop out way to differentiate because you are clearly not comparing apples to apples.
You have a fraction of the features and a fraction of the bug fixes. You are trying to make it sound like you are a 1:1 replacement, when you are not.
https://www.grammarly.com/blog/vocabulary/moot-point/
Continue this thread — 1 reply
Weren't the main points on the main page that it was small ("lighter than a React button"), and could handle large amounts of records ("far past where JavaScript (and React) would crash with a stack overflow error")?
This is misleading to people and the promise is so shallow that it almost feels insulting.
Also I recommend just not making a web framework. There are many of them, some very similar to Nue. Your effort could be placed on improving what is out there. I suspect that is a lot harder and less fun than just making something new. But if you manage to contribute then you’ll be helping an entire community of people whereas a new web framework will likely see almost no adoption before it is abandoned.
All comments shown.
Couldn't load more comments. Check your connection and try again.