Asset Canister performance and assets serve time

I have built a blog using one of the statis sites generator, which probably has too many pictures. Deployed in assets canister already.
Suprisingly, even a html page with 2 3 images taking too much time to get loaded in browser.
Now , I just want to know its usual with asset canister to take time before serving, or there is something wrong with Static Site generator (I mean there is some other way for optimisation).
I am using docusaurus.io as generator.
Also is there some way to cache assets of canister , If there is , please provide some reference.

The Internet Computer Portal uses Docusaurus as well (https://hwvjt-wqaaa-aaaam-qadra-cai.ic0.app/
You can look at the code and deployment actions here: GitHub - dfinity/portal: Internet Computer Developer Portal but I it doesn’t seem we’re doing anything special.

To be fair @domwoe, loading of the images on the IC portal is bad in my opinion:

  1. images should be provided if possible in a modern format (like webp) but at least compressed (some images are > 1mb!)

  2. images should be deferred and not loaded up-front when off-screen. e.g.

<img src="" />

// vs

<img src="" loading="lazy" />

note: above is bare minimum, we could even go further by providing various image sizes that matches best the device screen <img srcset />


@h1teshtr1path1

2 Likes

Thanks for jumping in @peterparker. Then we should aim to be a good example.

1 Like

Would be cool! Happy to help or review, ping me.

No, all images are viewport up-front only, no requirement of lazy loading there… Also I already compressed them in webp. But I was asking this just to make sure, if there is something I am missing , or this is due to asset canister methods of serving assets.

1 Like

Nice the webp :+1:

I don’t find the thread anymore but months ago we discussed the performance of serving static assets such as images and indeed, it’s a bit slower than web2+cdn cache but that’s the nature of it.

So to me, doesn’t seem you are missing something. Being said, if you drop me the link to your blog, happy to have a quick try / look.

1 Like