News for hackers. Stuff that matters.
Re:This website has 81% battery power remaining by marricks on Sunday December 12, 2021 @01:25PM (#29532124)
I hate to be that old foggy but, aren’t websites just getting worse and bloated with JS crap?

I’ve had a couple websites I use daily for work just get flashy new interfaces which causes 1/3 to 1/2 second delays in the interface which used to not exist, previously they just had normal page load delays.

For example, SalesForce Lightning, their UI overhaul. Old UI is mainly just flat HTML with some loading on fields. New UI doesn’t have as many page loads it seems but wherever you navigate to takes far longer to load because of api calls or just baaad JS.

Slow for the user, slow for the server. It's almost like the people who push website technology are the same one selling you servers. Hate it and want to go back.

Re:This website has 81% battery power remaining by hattmall on Sunday December 12, 2021 @02:32PM (#29532781)
I agree with this so so much.

The problem is too much reliances on frameworks and add on libraries.

Developers will import an entire framework that for the benefit of a single feature. It's mind blowing to look at the amount of js includes for seemingly simple sites.

Stackoverflow answers that direct you to import a library or framework should be banned in most cases.

I will often have to scroll past several answers that say to import a library before finding a simple and functional answer that uses only a few lines of code down near the bottom. Which in my eyes is the real answer. I often wonder if there's a behind the scenes effort on SO to promote certain includes.

The entire ecosystem of some languages / implementations relies on this far too heavily.

We are seeing some of the consequences other than just bloated systems from this style of coding with malicious node packages.

Re:This website has 81% battery power remaining by throwaway11602 on Sunday December 12, 2021 @03:12PM (#29533137)
I am guilty of this, and I feel bad for it. I am not a front end developer, but I have built a few web sites for various projects here and there. I certainly don't NEED to use a front-end framework, but I don't want have to spend a ton of time crafting CSS rules and figuing out how many divs to nest. To get something done quickly, my choices pretty much boil down to plain, unstyled, pages, or a full blown framework like Vuetify. So far, I haven't found anything in between. I would love to find a CSS library that I can just import and be able to create simple, nicely styled pages, e.g. that look Material-esque, without jQuery, node, npm, gulp, grunt, sass, and all that jazz.
Re:This website has 81% battery power remaining by mro_name on Sunday December 12, 2021 @03:46PM (#29533440)
do you know the matrix movie quote "but there is no spoon" – maybe the framework you look for is vanilla CSS. Write sensible markup to hold your content (almost no divs), CSS it and be good. Sounds that feasible?
Re:This website has 81% battery power remaining by throwaway11602 on Sunday December 12, 2021 @04:19PM (#29533719)
> ... vanilla CSS... Sounds that feasible?

Vanilla CSS is the other end of the spectrum, but the problem is there is apparently nothing between hand-crafted CSS and a full front-end framework. People, like me, who are not good at design will choose the convenience of the latter over going through the tedium of the former, even if we don't really want to.

Re:This website has 81% battery power remaining by mro_name on Sunday December 12, 2021 @04:27PM (#29533795)
You won't be a sculptor if you avoid the chisel. If in rome, do as the romans do. If you want to swim, you'll get wet.

There is no design in/for the web without html+css, is there?

Edit: by removing 3rd parties from your project you remove a lot of overhead and current and future risk. But be warned: Maybe your company sells exactly that for a good margin and you ruin the business model.

Re:This website has 81% battery power remaining by squeaky-clean on Sunday December 12, 2021 @07:40PM (#29535288)
We don't want to sculptors. We have other projects that just happen to require a sculpture as part of finishing them.

> There is no design in/for the web without html+css, is there?

Only as much as there's no programming without assembly language.

Re:This website has 81% battery power remaining by mro_name on Monday December 13, 2021 @02:20AM (#29537501)
> We don't want to sculptors.

It is really sad that you are forced to do things that you believe you are not capable of doing and refuse to do.

Re:This website has 81% battery power remaining by squeaky-clean on Monday December 20, 2021 @12:10PM (#29627177)
It's not that I don't believe I'm capable of it. I do not want to do it. I'm happy to not have to do it.

When did I ever say I was not capable of doing it? It's really sad the way you push your mindset on others.

Re:This website has 81% battery power remaining by chakkepolja on Sunday December 12, 2021 @03:26PM (#29533264)
What's your opinion about bootstrap? Unfashionable I get it, but doesn't it serve the purpose?
Re:This website has 81% battery power remaining by throwaway11602 on Sunday December 12, 2021 @04:21PM (#29533738)
It's been a long time since I looked at Bootstrap. I don't remember it being anywhere near as easy to create a nice-looking page with it as it is with Vuetify.
Re:This website has 81% battery power remaining by avrgamp on Monday December 13, 2021 @08:16AM (#29539279)
How about Tailwind?
Re:This website has 81% battery power remaining by mattl on Sunday December 12, 2021 @04:13PM (#29533674)
Bootstrap is unfashionable?
Re:This website has 81% battery power remaining by citizenkeen on Sunday December 12, 2021 @04:43PM (#29533951)
In the same way that Corollas, Applebee's, and Walmart brand jeans are unfashionable, yes.
Re:This website has 81% battery power remaining by toastal on Monday December 13, 2021 @12:43AM (#29537022)
Bootstrap v2 had a LOT of unnecessary features while simultaneously lacking features because of Less limitations. By v5 it was significantly slimmed down if not for removing IE support and jQuery, but also a lot of rarely-used components.
Re:This website has 81% battery power remaining by onion2k on Sunday December 12, 2021 @02:26PM (#29532719)
aren’t websites just getting worse and bloated with JS crap

Maybe they are, but that bloat is just some static files that are sent to the user as far as the web server is concerned. They should have no practical impact on the battery life of the server.

There are JS sites that render on the server as well, but that's not the bloat you mean.

Re:This website has 81% battery power remaining by Wowfunhappy on Sunday December 12, 2021 @02:49PM (#29532957)
And, heck, there's a solid argument that server-side rendering is more environmentally efficient, since the work is done in a data-center, which can (1) utilize caching to avoid re-doing work and (2) be built in an optimal location for electricity generation.
Re:This website has 81% battery power remaining by nathanfig on Sunday December 12, 2021 @03:15PM (#29533174)
Conversely, you are losing the distributed computing gained by rendering on the client, and therefore need a bigger server to scale when needed. And HTTP caching can and should be used for API responses as well.
Re:This website has 81% battery power remaining by Wowfunhappy on Sunday December 12, 2021 @06:15PM (#29534700)
If we're measuring by total resource consumption regardless of location, is distributed computing beneficial? Your server can be less powerful, but the client needs to be more powerful. I'd think the primary difference is who's paying for it.

Sure, most clients may already be adequately provisioned, but only because so many websites with bloated Javascript have forced their hand...

Re:This website has 81% battery power remaining by rhizome on Sunday December 12, 2021 @06:50PM (#29534938)
>Maybe they are, but that bloat is just some static files that are sent to the user as far as the web server is concerned. They should have no practical impact on the battery life of the server."

...and if those static files make 100 API calls as soon as they land?

Re:This website has 81% battery power remaining by chakkepolja on Sunday December 12, 2021 @03:25PM (#29533257)
I think he is talking about badly written JS code serving the APIs and the overhead of it.

Of course it's hard to debate whether JS, Java or PHP is most inefficient in that regard.

Re:This website has 81% battery power remaining by onion2k on Sunday December 12, 2021 @04:51PM (#29534012)
I strongly believe that the efficiency of an API is 1% down to the language it's coded in, and 99% down to who coded it.
Re:This website has 81% battery power remaining by yjftsjthsd-h on Sunday December 12, 2021 @05:53PM (#29534533)
Yes and no; while it's still true that you can write FORTRAN in any language, there are network effects that mean the effort required to write efficient code is different per language/community/framework.
Re:This website has 81% battery power remaining by ComputerGuru on Monday December 13, 2021 @12:28AM (#29536935)
I think that’s true if you take a no dependencies approach but as soon as you tap into the ecosystem the argument is lost.
Re:This website has 81% battery power remaining by onion2k on Monday December 13, 2021 @02:06AM (#29537438)
Not really. It still depends on who coded it. It's just that there's more people involved now.
Re:This website has 81% battery power remaining by labster on Sunday December 12, 2021 @05:58PM (#29534578)
Corollary: The average API is far less efficient than the languages you like to complain about their efficiency.
Re:This website has 81% battery power remaining by Beached on Sunday December 12, 2021 @01:36PM (#29532227)
it's gotten out of hand imo. page load times take longer than when I was browsing the web on dialup in many cases.
Re:This website has 81% battery power remaining by mro_name on Sunday December 12, 2021 @01:40PM (#29532273)
Website Obesity crisis going on and on: https://idlewords.com/talks/website_obesity.htm

Was here on HN several times, sadly still the case.

Re:This website has 81% battery power remaining by hutzlibu on Sunday December 12, 2021 @06:20PM (#29534733)
"I don't care about bloat because it's inefficient. I care about it because it makes the web inaccessible.

Keeping the Web simple keeps it awesome. "

Re:This website has 81% battery power remaining by kgeist on Sunday December 12, 2021 @02:41PM (#29532885)
I don't know, we're currently rewriting our UI from the classic "PHP renders everything with almost zero JS" to the more modern "single page application with a crap ton of JS" and the new UI feels much faster to me. The old way was to resend and rerender everything on each click, which is problematic for complex UIs with a lot of data.
Re:This website has 81% battery power remaining by selfhoster11 on Monday December 13, 2021 @05:02AM (#29538248)
On a modest 3 year old phone running Firefox, such websites are excruciating.
Re:This website has 81% battery power remaining by jmondi on Sunday December 12, 2021 @02:14PM (#29532596)
What a false equivalence. You are comparing static sites of the past to dynamic sites of today. Apples to oranges.
Re:This website has 81% battery power remaining by Nextgrid on Sunday December 12, 2021 @02:18PM (#29532636)
The vast majority of sites don't need to be dynamic though.
Re:This website has 81% battery power remaining by RussianCow on Sunday December 12, 2021 @03:16PM (#29533186)
[citation needed]

Websites have become significantly more complex in the last two decades.

Re:This website has 81% battery power remaining by Nextgrid on Sunday December 12, 2021 @03:37PM (#29533372)
Let’s look at Twitter for a real-world example. The core concept of it hasn’t changed, it still just has to display a blurb of a few hundred characters at most. Back in the day this was achieved by server-side-rendered HTML and a simple form POST. I don’t have the numbers for the page back then but I’d estimate it at 100KB - nowadays it’s a multi-megabyte-sized pile of shit that often fails at its primary purpose of displaying a block of text with a stupid “something went wrong” message or endless spinner.

The “new” Reddit is also a good example. Even ignoring all the user-hostile functionality changes, the actual experience is still slower and less reliable.

Re:This website has 81% battery power remaining by roywiggins on Sunday December 12, 2021 @06:17PM (#29534717)
And for proof that you can do better, Nitter is a better Twitter interface than Twitter is, and it's much lighter.
Re:This website has 81% battery power remaining by can16358p on Sunday December 12, 2021 @06:55PM (#29534979)
Reddit web is incredibly sluggish. I open the app to browse which is a smooth experience (putng aside dark patterns).

Same for Twitter. Maybe it's intentional to move users into the app, where ads are more likely to be actually seen (e.g. Many web users have ad blockers) and in app purchases are frictionless.

Re:This website has 81% battery power remaining by Nextgrid on Sunday December 12, 2021 @11:16PM (#29536539)
Just FYI, for Reddit there's an amazing third-party client called Apollo on iOS, and I'm sure there are others too, same on Android.
Re:This website has 81% battery power remaining by can16358p on Monday December 13, 2021 @07:01AM (#29538803)
Yeah I have it. I actually made the in app purchase to support the developer.

I ended up going back to the official app which I think is nice, but also feel nice about financially supporting an indie developer who does a nice third party client for a (generally) awesome community.

Re:This website has 81% battery power remaining by unionpivo on Sunday December 12, 2021 @06:23PM (#29534757)
Really ?

Take for instance news sites or blogs: When I read news article, what I want is mostly (there are some great interactive infographics, but those are tiny minority) text and few images, that are static.

And it's not like that as a consumer I get anything extra. The text and images are still static, for the most part. Except that now its makes 20 separate requests to load it all up. Hell, pages are usually even less dynamic, after comments fell out of favor.

What increased is number of extra stuff, that is mostly focused on selling me stuff, tracking every metrics possible, and trying to figure out somne clickbait I would click next for extra engagement.

But that's not content, content has largely stayed the same.

Re:This website has 81% battery power remaining by Nextgrid on Sunday December 12, 2021 @11:14PM (#29536524)
I don't believe the bloat of modern websites is because of ad-tech of dark patterns - all of these can still be done with an otherwise lightweight website. If anything, ads (excluding intentional resource usage such as crypto-miners) would be much lighter than what a typical SPA website like Reddit or Twitter is.

I believe what's happening is a broader trend in the industry of building engineering playgrounds and doing engineering purely for engineering's sake to benefit one's career - a positive feedback loop where not participating puts developers at a disadvantage as they won't gain over-engineering skills that companies now require (they require them because their developers or managers want them for the same reason).

Re:This website has 81% battery power remaining by ComputerGuru on Monday December 13, 2021 @12:34AM (#29536964)
Text-only NPR: https://text.npr.org/
Re:This website has 81% battery power remaining by netizen-936824 on Sunday December 12, 2021 @03:36PM (#29533358)
I don't want my browser to be loading entire JS frameworks and trackers and whatever other crap just to read a bunch of text. That's absolutely nonsensical
Re:This website has 81% battery power remaining by damir on Sunday December 12, 2021 @04:02PM (#29533576)
I'm using two browsers, one with disabled JS (primary) and vanilla one. When and only WHEN page doesn't load on non-js browser (and if I really, really, reaaaally want that piece of content) then maybe I will use vanilla browser...

Browsing with js disabled is fast, pages load quickly, almost no trackers and there are "old" or "text" versions of sites still available... old.reddit, old.twitter or nitter instances...

Heck, even google has one...

To be honest, I just use dillo browser most of the time. Small, speedy and safer then most...

Edit: typo.

Re:This website has 81% battery power remaining by dylan604 on Sunday December 12, 2021 @03:27PM (#29533268)
For the user's benefit, or for the dev's?
Re:This website has 81% battery power remaining by Nextgrid on Sunday December 12, 2021 @03:33PM (#29533331)
Or the advertises/whatever assholes profit of “engagement”?
Re:This website has 81% battery power remaining by _jal on Sunday December 12, 2021 @02:49PM (#29532958)
When you replace one with the other and notice a substantial change in time-required-for-task, I think you can make comparisons.
Re:This website has 81% battery power remaining by BostonEnginerd on Sunday December 12, 2021 @03:39PM (#29533386)
We’ve recently transitioned to Salesforce for a project. It’s remarkable how laggy the interface is. Removing a line from a quote takes three clicks and four seconds. The UI also doesn’t always refresh the items in a reasonable period of time, requiring a page reload.

Reloading the page is like 20MB as well. Great when you’re tethered to your phone.

Re:This website has 81% battery power remaining by robbedpeter on Sunday December 12, 2021 @05:25PM (#29534313)
I agree. There needs to be a substantial effort in web development to shed the bloat. Clean and small reduces issues with resources, security, and maintainability. The status quo is gross.
Re:This website has 81% battery power remaining by culi on Sunday December 12, 2021 @03:36PM (#29533359)
You're not alone in feeling this way

https://handmade.network/manifesto

Re:This website has 81% battery power remaining by simion314 on Sunday December 12, 2021 @01:42PM (#29532307)
>and bloated with JS crap?

CSS animations too , especially the ones that use infinite.

Re:This website has 81% battery power remaining by scrollaway on Sunday December 12, 2021 @01:55PM (#29532407)
Nothing to do with site hosting. css animations don't eat the server's CPU; nor does JS bloat (other than bandwidth).
Re:This website has 81% battery power remaining by Retric on Sunday December 12, 2021 @02:12PM (#29532575)
JS bloat can have significant server overhead when data is loaded dynamically. It’s generally more efficient to have one GET request that can be heavily optimized than a lot of tiny XMLHttpRequest that need to be parsed separately. That may flip around when someone spends a long time interacting with a SPA, but there is plenty of truly terrible code in the wild.
Re:This website has 81% battery power remaining by kevin_thibedeau on Sunday December 12, 2021 @05:11PM (#29534183)
I've built embedded web interfaces serving up static pages that were precompressed with gzip and then used XHR to fill in dynamic content. I kept it under 100K for the uncached download (zero third party scripts). Everything worked well and was reasonably lightweight as long as you avoided framework bloat. Not having to compress anything on device helps a bit on energy usage although that wasn't a concern.
Re:This website has 81% battery power remaining by RussianCow on Sunday December 12, 2021 @03:21PM (#29533226)
> It’s generally more efficient to have one GET request that can be heavily optimized than a lot of tiny XMLHttpRequest that need to be parsed separately.

Without context, this statement is misleading at best and downright false at worst. You’re right that splitting up a single request into multiple would incur a small performance penalty, but you also generally gain other advantages like more localized caching and the ability to conditionally skip requests. In the long run, those advantages may actually make your app significantly more efficient. But without discussing details like this, it’s pointless to make wild assumptions about performance.

Re:This website has 81% battery power remaining by Retric on Sunday December 12, 2021 @03:42PM (#29533423)
The context was JS bloat, so we are specifically talking about the subset of poorly written sites. When it’s possible to shoot yourself in the foot many people will do so.

That said, if you ever actually profile things you will find the overhead per request is actually quite high. There is a clear tendency to request far to little data at a time.

Re:This website has 81% battery power remaining by simion314 on Sunday December 12, 2021 @02:40PM (#29532873)
yes, I wanted to add that css (especially infinite)animation also eats the client energy and CPU.
Re:This website has 81% battery power remaining by marricks on Sunday December 12, 2021 @02:14PM (#29532601)
I like a good clean CSS animation! They can be very short and meaningful. Maybe not for daily driver UI but somethings I like them.

Infinite scrolling could be annoying with animations though, I grant you that.

Re:This website has 81% battery power remaining by simion314 on Sunday December 12, 2021 @02:42PM (#29532892)
My issue is with infinite animations, constantly moving/blinking stuff. They also do not have same effect on different system configurations so you might not notice any effect on your dev machine and on users it makes the page unusable, and some are super distracting).
Re:This website has 81% battery power remaining by flatiron on Sunday December 12, 2021 @01:53PM (#29532379)
The new lightning makes it such a pain to do my time cards. Try to open my sub projects to see how many hours are left and have a tab open with my time card and constantly errors out. I can’t be the only person who checks hours left on sub projects when entering my time.
Re:This website has 81% battery power remaining by calebwinston on Sunday December 12, 2021 @06:38PM (#29534866)
Genuine question from a not-a-web-developer: Is this not mitigated by minimization tools like webpack?
Re:This website has 81% battery power remaining by toastal on Monday December 13, 2021 @12:47AM (#29537053)
Webpack is a front-end build toolchain, not a minifier. Usually Terser is used inside of Webpage to minify.