top | item 33030311

(no title)

jeffmcmahan | 3 years ago

Why is modern software slow? Because Joe developer's solution to a given problem is to Google up a package that solves the problem, check the license, and then run:

   > { packageMgr } install { randomPkg }
Developer Andy, author of { randomPkg }, does the same thing. And so on, ad infinitum. You want to sum two numbers?

   > npm install node-plus
And the source code will be:

   import { readFile } from 'node:fs/promise'
   import { dirname, join } from 'node:path'
   import additionChecker from 'add-check'

   // redundant useless comments

   return function(n1, n2) {
       // redundant useless comments
       n1 + n2
   }

discuss

order

ChadNauseam|3 years ago

In many cases this is the opposite of true. GTA online had a bug in their home-rolled json parser that caused it to read files in O(n*2), which went unfixed for years and added minutes to the loading time. That bug is much less likely to exist in a popular open-source package, because there are more eyes to catch it and fix it.

llanowarelves|3 years ago

Yep. Game devs handroll lots and release back to public much less than other tech companies. Not unheard of to even forego c++ stdlib and rolling their own structures.

In these cases it's not a matter of not understanding the low level internals.

Dylan16807|3 years ago

That kind of thing won't make a program significantly slower other than a second or two to load, and won't make compiled programs slower at all.

jeffmcmahan|3 years ago

No no you're so right. Let's have 500 packages installed to do multiplication. Zero performance impact, I'm sure.

userbinator|3 years ago

It all adds up.

kajaktum|3 years ago

This is necessary in JS because the language itself is broken. You actually can't JUST add 2 "number"s because they might not actually be numbers. Writing raw JS is like writing raw assembly.

jeffmcmahan|3 years ago

Forgive me for having chosen pseudo js for the example - and npm. That conflates the issue. I meant to convey an attitude - let some random package do the work, who cares whether it is deep and complex and handling cases I won't ever need, offering API surface that will go unused, and perhaps doing simple things inefficiently. The language doesn't much matter if "ship ship ship rn" is the ethic that drives decision making.

Tomis02|3 years ago

You guys check the license?