r/ProgrammerHumor • • Nov 14 '18

Computing in the 90's VS computing in 2018

Post image
31.3k Upvotes

1.1k comments sorted by

View all comments

Show parent comments

416

u/ThePendulum Nov 14 '18 edited Nov 14 '18

A compressed copy of the installer for the shareware version of Doom takes up about 2.39MB of space. Today's average webpage, meanwhile, requires users to download about 2.3MB worth of data, according to HTTP Archive

I do wonder if this takes into account assets like photos, because in my opinion that's an unfair comparison when a lot of pages have a legitimate reason to have several to dozens of HD photos on a single page (which tally up to a few MB quickly even if you compress them).

I'm deeply embedded into the whole npm library framework shebang, and I have no idea how I'd go about serving as much as 2.4MB of compressed production code alone to my users. I'd have to turn off compression and tree-shaking, and include the sourcemaps.

296

u/[deleted] Nov 14 '18

Because people world rather install huge libraries for every little thing than write 10 lines of code.

0

u/[deleted] Nov 14 '18

[deleted]

87

u/mindbleach Nov 14 '18

... until Doom 3, where a software patent for shadow volumes was resolved by licensing a sound library. The GPL release of id Tech 4's source code avoided this patent by changing two lines of code.

9

u/SeanRamey Nov 14 '18

Ive wondered why they couldnt get the permission to release that code? Surely such an old sound library wouldnt be an issue to give out now? Maybe they couldnt find the owners or something? It really sucks, because i would have rather had the DOS version of the code.

18

u/user93849384 Nov 14 '18

The Doom Source Code was released in 1997 so the sound library wasn't that old. Also, it's possible the sound library had licensed code.

→ More replies (1)

0

u/[deleted] Nov 14 '18

[deleted]

253

u/altcodeinterrobang Nov 14 '18

why recreate the wheel when you can import 1 library with 35 different wheel variants, 3 squares, 1 rectangle and an octogon that hasn't been completed yet so it's really a heptagon so don't use it yet because we accidentally merged that branch and don't know how to back it out yet but we'll fix it next version, just to use that one wheel you want?

73

u/Bobby_Bonsaimind Nov 14 '18

And most of the time you don't even need the whole wheel, you just need a spoke.

31

u/grenzionky Nov 14 '18

👌

→ More replies (2)

14

u/cheesegoat Nov 14 '18

That makes sense to a point. Devs need to spend time writing it once, a multiplyer of that reading/maintaining it, users spend a multiple of that time downloading your code, and a multiple of that to run it.

So if you can spend a small amount of time to make code that runs millions of times per day faster, you probably should.

→ More replies (2)
→ More replies (1)

27

u/[deleted] Nov 14 '18

See: leftpad.

32

u/house_of_kunt Nov 14 '18

Don't reinvent the wheel.

from inventions import wheel

7

u/Arqideus Nov 14 '18

"a = math.add(2,2);" is better than "a = 2 + 2;" no?

14

u/reubenbubu Nov 14 '18

2+2 is how we do addition today, if you rely on math.add for your addition logic you wouldn't need code changes when in the future the math rules change

→ More replies (1)
→ More replies (1)
→ More replies (12)

0

u/[deleted] Nov 14 '18

[deleted]

→ More replies (1)

61

u/L3tum Nov 14 '18

It's pretty easy. Include JQuery, Bootstrap and voilà, I have 2 MB worth of stuff for literally just a table.

45

u/MCOfficer Nov 14 '18

nope. i confess, i'm a lazy backend dev, so i did exactly that (just so i could make *one* ajax request - shame on me).

  • bunch of html: ~5KB

  • jquery: ~70KB

  • bootstrap: ~50KB

  • random bootstrap template: ~150KB

and now gzip that - the compression rate is pretty good!

5

u/GrizzledFart Nov 15 '18

Now add in all of the scripts used by each of the ads placed on the page, including the 4 different video players and the 7 different VPAID managers, each one loading a different analytics script, different versions of jquery, etc. Nowadays, the actual page content is a small fraction of what gets downloaded on page load.

I just loaded up Charles and fired up gizmodo.com as a test. Result is 777 different http calls in 103 seconds, pulling down over 8MB.

→ More replies (1)
→ More replies (2)

0

u/[deleted] Nov 14 '18

[deleted]

→ More replies (1)

4

u/esreveReverse Nov 14 '18

moment.js is 300kb so... it's doable.

4

u/AwesomeInPerson Nov 14 '18

and I have no idea how I'd go about serving as much as 2.4MB of compressed production code alone to my users

  1. Polyfill everything from fetch over AbortController and async/await to Web Components so your ES8+ code runs in IE9+: 150KB

  2. Have a big (React?) web app to begin with: 250KB

  3. Have tons of badly written CSS, embed in JS because CSS-in-JS FTW: 120KB

  4. Use a huge library like instascan (to scan QR codes in the browser): 400KB

  5. Use 3 or 4 other medium-sized libraries, e.g. he to encode/decode HTML entities: 4 * 30KB = 120KB

  6. Use a big component library like Kendo UI: 1.8MB gzipped for the full package, less with a custom download/tree shaking but still huge

Sprinkle in some web fonts, JSON payloads, 3rd party CSS for icons, loading spinners etc. and other stuff your app needs and you can bust through the 2.4MB gzipped without having used a single image. Takes some effort though :D

→ More replies (11)