News for hackers. Stuff that matters.
Re:Alpine.js by dx034 on Friday January 13, 2023 @09:09AM (#34367946)
Or for people with bad connections. If you expect high latency it can be worth it to embed js code to avoid the additoinal roundtrip. 10kb makes a big difference for that.
Re:Alpine.js by wruza on Friday January 13, 2023 @10:09AM (#34368749)
Which sites do that for any meaningful reason? I see this argument often, but have a hard time either coming up with an idea of a business for which it would be non-marginally profitable or finding a real app/site which does that to cover the last mile of its world-wide scale.

Until that I believe this argument is equivalent to “what about Mars”. By supporting dead slow connections on Earth you simply support them to remain so.

Re:Alpine.js by reflectiv on Friday January 13, 2023 @10:41AM (#34369268)
> Which sites do that for any meaningful reason?

Literally none...this is just the argument of contrarians or people who've only ever worked on personal projects who take offense to real applications used by actual audiences.

Re:Alpine.js by dx034 on Saturday January 14, 2023 @01:19PM (#34382496)
In itself 10kb doesn’t make a difference. But it adds up so that this mindset can lead to noticeably faster pages.
Re:Alpine.js by lelandfe on Friday January 13, 2023 @11:29AM (#34370047)
As someone who has shipped thriftily-sized sites targeting developing countries, what you're describing is a needlessly extreme optimization. Inlining 3kb of data vs. 13kb would be a nearly unnoticeable difference for even the worst connections – like in Guinea, whose median download speed is around 3mbps.

Inflating the document size does impact paint time, but it scarcely matters here.

Re:Alpine.js by gaganyaan on Friday January 13, 2023 @09:15PM (#34376688)
I'm currently on a roaming cell phone connection where T-mobile has graciously given me 256 Kbps down. That actually would be a noticeable size difference. I don't have a deeper point, just thought it was funny that I would love a 3 Mbps connection right now.
Re:Alpine.js by dx034 on Saturday January 14, 2023 @10:03AM (#34380800)
There are a lot of places in Europe where you won’t get 3mbits with your phone.
Re:Alpine.js by mekster on Friday January 13, 2023 @11:57PM (#34377496)
Bad advice.

You don't embed same piece of code on every page request but instead you make the code cached on first download.

Re:Alpine.js by dx034 on Saturday January 14, 2023 @01:20PM (#34382507)
Depends on users and usage. If most visitors haven’t been to your site in a while and visit few pages it can be worth embedding.