DEV Community

How we decreased load time by 40% by removing just 1 file

Mladen Stojanovic on June 28, 2018

So the title of this article is really clickbait-ish, but in reality it is exactly what happened. I started working on a project around ...
Collapse
 
xngwng profile image
Xing Wang

I recommend run your website through google's speed test, it will reveal a lot of things.
Things like the one you mentioned will be discovered immediately with no work.

developers.google.com/speed/

Collapse
 
mladenstojanovic profile image
Mladen Stojanovic

Have you tried webpagetest.org/ ? I think it is way better than google's speed test, gives a lot more stats!

Collapse
 
nektro profile image
Meghan (she/her)

The more tests the better! DevTools has great auditing tools as well!

Thread Thread
 
mladenstojanovic profile image
Mladen Stojanovic

Yessss, devtools are awesome!

Collapse
 
jsn1nj4 profile image
Elliot Derhay

As soon as you said "8 decently sized images", my immediate thought was "please, no. Not base64-encoded images in CSS..."

I have to wonder why someone would do that -- at those dimensions, I'm guessing they're photos?

Collapse
 
mladenstojanovic profile image
Mladen Stojanovic • Edited

I have no idea, it was 8 photos (4 different photos in 2 sizes) for a 500 page, which kinda makes sense, BUT, they were too big to be base 64 encoded, and they didn't create any sort of loading in chunks or whatever so it was loaded every time the site was entered, crazy!

Collapse
 
jsn1nj4 profile image
Elliot Derhay

Agreed. There needs to be a reasonable size limit and purpose decided on for doing that sort of thing.

Collapse
 
joshcheek profile image
Josh Cheek

Love it!

I found something similar: We were shipping fkn megs of data in our SSR'd JSON payloads. Curled the endpoint, used sed to strip it down to the JSON, a small JS script to unminify it, and then started exploring with jq. After a little bit, realized that 90% of the payload was duplicated at another location in the payload. Turns out we were using some redux and so some toplevel component received the data, hung onto it, and passed it to one of its children. In memory, this isn't an issue b/c they both point to the same spot in memory. But JSON doesn't have a feature for referencing values from other spots in the structure (interesting note: YAML does). So, when we serialized the entire state, that memory got rendered twice. Turns out it wasn't needed by the parent, so we removed it and the initial payload was cut by almost half.

Collapse
 
mladenstojanovic profile image
Mladen Stojanovic

Yikes, what a weird problem :)

But that feeling when you delete it and it starts working so fast... Priceless :D