798
submitted 8 months ago by schizoidman@lemmy.ml to c/technology@lemmy.ml
you are viewing a single comment's thread
view the rest of the comments
[-] KingThrillgore@lemmy.ml 27 points 8 months ago

I ended up using a static site generator for my personal site because I fucking hate JS and frameworks and WebComponents. The front page is 646 KB and it loads in 4 seconds. I'd love for it to be 1 second or less, but the fonts are a factor.

And I shrunk the shit out of that background too with pngcrush so miss me with that.

[-] autokludge@programming.dev 16 points 8 months ago

Haven't done this type of optimizing in a long time, I had a quick look at the network graph for your front page (F12 dev tools in desktop browser), my understanding is it looks like you are getting blocked from loading additional resources (fonts + background) until your style sheets are fully read --pink line is document loaded i believe.

It may be worthwhile to experiment with adding some preload links to the html template? or output? like below and assessing if it makes things faster for you.

<link rel="preload" as="image" href="https://volcanolair.co/img/bg1-ultracompressed.webp" fetchpriority="high">

<link rel="preload" as="font" href="https://volcanolair.co/fonts/Inter-Regular.woff2">

<link rel="preload" as="font" href="https://volcanolair.co/fonts/Inter-Bold.woff2">

___

[-] phoenixz@lemmy.ca 14 points 8 months ago

Honestly, 4 seconds is really slow, especially with static HTML. I built my first companies' site myself, it includes a video on the front page and jquery, is built by PHP, and on descent Internet connections the front page will load in slightly over a second, other pages dip under that.

There are loads of tweaks you can make to -any- site, and total amount of bytes really isn't the only speed factor here.

[-] TopRamenBinLaden@sh.itjust.works 12 points 8 months ago* (last edited 8 months ago)

Not that you'd want to because you hate JS and web components and all that, and there's nothing wrong with your website, but NextJS supports Static Site generation.

So, JS and frameworks and webcomponents can get the job done for simple stuff nowadays. My portfolio page has a load time of 631 ms using the SSG built into NextJS, and its really similar to your website.

[-] JasonDJ@lemmy.zip 12 points 8 months ago* (last edited 8 months ago)

I love all your replies.

You wouldn’t get these responses from stackoverflow.

This isn’t even a programming or development community…it’s a general interest one.

You didn’t even ask for help.

[-] KingThrillgore@lemmy.ml 3 points 8 months ago* (last edited 8 months ago)

I gotta say I came in here to flex and I learned so much. I am going to roll some of these changes really soon once I find out where to best add them to my Hugo template. I'm going to reply to some of them below to clarify some things:

It may be worthwhile to experiment with adding some preload links to the html template? or output? like below and assessing if it makes things faster for you.

This is the most interesting because I didn't even know this was possible with HTML5, so I want to add this right away.

I have a pixel 6 and notice some lag in scrolling. Could it be that you don’t use srcsets but instead huge screenshots no matter the device screen?

The background is a large image in the CSS via background-image, I don't know how easy it would be to change it to a srcset but I will give it a shot

The fonts can be loaded from another file that ends in the cache, lowering load time next time.

At the very least they need to load last because they are the largest burden

[-] TCB13@lemmy.world 9 points 8 months ago* (last edited 8 months ago)

My front page is 613KB with Wordpress. Moral of the story, you don't have to use a static website generator to have light things.

[-] Harbinger01173430@lemmy.world 2 points 8 months ago

Can I achieve the same with vue.js or flutter? I need to learn this

[-] TCB13@lemmy.world 1 points 8 months ago

And how do you plan to manage your posts, database etc. and render stuff in those? You still need some backend solution like Wordpress, you can use vue as a frontend library for it… or vanilla JS, or jQuery..

[-] Harbinger01173430@lemmy.world 1 points 8 months ago

Ah, for that I'll just dump some fast API or flask thing. Vue or flutter will just handle the front end

[-] TCB13@lemmy.world 1 points 8 months ago

So... you are aware that FastAPI and Flask will always be significantly slower than Wordpress... because Python, always running processes etc.?

You're building a simple website / blog just use Wordpress, it will output most of the pages into plan simple and fast HTML, then add a few pieces of vanilla JS or Vue (if you're into that) to make things "fluffier". Why bother with constant XHR requests when you're just serving simple text pages?

With Wordpress you'll also get all the management, roles, permissions, backend for "free" and you can always, like sane people, cache the output of the most visited pages. Wordpress also provides a RESTful API if required.

[-] Harbinger01173430@lemmy.world 1 points 8 months ago

No I mean, I wanna make a full project but without bloating the front end website

[-] fuzzzerd@programming.dev 1 points 8 months ago

Yes. You can. I have a personal site that is using nuxt static site mode and it renders extremely fast and clean output.

[-] fuzzzerd@programming.dev 1 points 8 months ago

Check out https://250kb.club all performance sites focused on speed and small size.

[-] fuzzzerd@programming.dev 2 points 8 months ago

Or maybe the 512kb.club a more reasonable balance between 250 club and the 1mb club.

Also with a view: jankfree.org for a similar focus on performance.

[-] ShortFuse@lemmy.world 8 points 8 months ago

The entire Material Design framework in JS and Web Components in 80kb

https://clshortfuse.github.io/materialdesignweb/components/buttons.html

JS and Web Components are not the problem. Poor design is.

[-] veniasilente@lemm.ee 8 points 8 months ago

, but the fonts are a factor.

I'm not sure if the possibility is there depending on your use case (eg.: you are exporting the fonts) nor if the cost of doing it would be worth the shot, but you can send minified ~~versions~~ variants of fonts, too.

[-] flying_sheep@lemmy.ml 4 points 8 months ago

I have a pixel 6 and notice some lag in scrolling. Could it be that you don't use srcsets but instead huge screenshots no matter the device screen?

[-] bufalo1973@lemmy.ml 3 points 8 months ago

The fonts can be loaded from another file that ends in the cache, lowering load time next time.

[-] sugar_in_your_tea@sh.itjust.works 2 points 8 months ago* (last edited 8 months ago)

Loaded pretty much instantaneously on my phone (a second at most). Then again, I block third party fonts.

this post was submitted on 18 Mar 2024
798 points (99.0% liked)

Technology

34973 readers
237 users here now

This is the official technology community of Lemmy.ml for all news related to creation and use of technology, and to facilitate civil, meaningful discussion around it.


Ask in DM before posting product reviews or ads. All such posts otherwise are subject to removal.


Rules:

1: All Lemmy rules apply

2: Do not post low effort posts

3: NEVER post naziped*gore stuff

4: Always post article URLs or their archived version URLs as sources, NOT screenshots. Help the blind users.

5: personal rants of Big Tech CEOs like Elon Musk are unwelcome (does not include posts about their companies affecting wide range of people)

6: no advertisement posts unless verified as legitimate and non-exploitative/non-consumerist

7: crypto related posts, unless essential, are disallowed

founded 5 years ago
MODERATORS