This is why this site is so slow

Started by
1 comment, last by khawk 1 month ago

Have a visit to the front page, https://gamedev.net/​. For me it takes 5 seconds to load completely. Wonder why? It's because this site can't be bothered to resize user's uploaded images to a few resolutions (e.g. 128px, 512px, full size) of a known format (JPG, webp).

Just looking at the blog section and viewing each raw image. I see images with sizes: 2.9 MB PNG, 130 KB JPG, 7KB JPG, 1.3 MB PNG. These images are displayed at a 80px by 100px resolution on my display. There's absolutely no reason to be embedding multi-megabyte 1080p PNGs on the front page when they are displayed at that size. It slows down the entire site, plus wastes bandwidth and browser resources on the user's machine.

This is like CS 101 Baby's First Website sort of stuff. You have to have a sanitization pipeline on any images that the user can upload to prevent these issues, which can be done in just a few lines of PHP code. Resize the images to a few different known sizes, e.g. a mip map pyramid, and convert anything that shouldn't be transparent to JPG or webp. Then pick the right size image for the usage. On the front page, you use the small thumbnail, on the blog post itself you show the full size image (unless it's really really big like 4K or 8K). Easy.

Advertisement

Actually images are resized.. but I have some clues what's happening for a solution.

Admittedly, the image handling pipeline is fairly basic in comparison to modern web practices, and use of other formats or modern techniques would certainly be a benefit.

I'd like to see your “few lines of PHP code” though for an image sanitization pipeline! Could be helpful. (GDNet is python fyi)

Admin for GameDev.net.

This topic is closed to new replies.

Advertisement