5 ms·
I don't think its physically possible to read this in the time since its been posted, but since people are commenting anyways I might as well join in. I've bee
by randombytes6869 6y ago
I don't think its physically possible to read this in the time since its been posted, but since people are commenting anyways I might as well join in.
I've been using JS since the JScript days, and let me tell you it was horrible. Awful. I would rather use VBA, Perl, early PHP, really anything I've touched besides COBOL. It was buggy, horrifically slow, had an even worse standard library than it does now, didn't work the same way between anything. I remember testing performance and getting 1000 integer increments a second in an empty for loop. Even back then an alarm clock running C was orders of magnitude faster.
But the massive popularity of the web has made it decent. Its a good example of the (overused) axiom that you can pour enough money into anything and make it good. With JS, this actually happened. Probably because the other choice was transitioning the web to Flash, Silverlight, and Java Applets. The proprietary solutions lost the battle thankfully, even though admittedly they were better than JS for a long time after they died.
There's still lingering problems, some which may prove un-fixable. The standard library is a joke. The 1 million line ancient Java monolith at work pulls in less libraries, by count and space then create-react-app. And not having threads is just terrible. People that don't know better ape over async, not knowing that most languages have async, threads, sometimes fibers, and fast shared memory between them. And NPM works decently but putting 5 million files into my node_modules folder is absurd. NPM is the only reason I know that most OS'es still have a path length limit. You would think the world could standardize on putting libraries into a zip or something like even ancient crufty languages like Java do. If it wasn't for SSD's modern JS wouldn't even be usable. And can we just compile JS already? Minification seems so normal that everyone's forgotten its a shitty hack. If you're going to minify to the point that JS resembles bytecode why not just standardize a format. People say "JS runs right away because its not compiled"... Well... How long does your WebPack take to transmogrify 150MB of spaghettified JS into a pile of chunks you can actually feed a web browser in prod? Probably longer than it takes most languages to compile. If we just compiled to a reasonable format like other VM languages, we wouldn't waste so much time parsing and keeping these tools working with every semantics update.
Here's to the hope that money poured into JS will finally fix the remaining issues. I give it another ten years and I'll finally enjoy most of my time in JS land.
- orange8 6y agoNPM is not the standard JS library, more like the most popular third-party JS package manager and repository. It does not really have an official standard library. The closest to that is are its built in objects (https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference https://developer.mozilla.org/en-US/docs/Web/JavaScript/Refe...).
- randombytes6869 6y agoThis is actually how maven is for Java as well. the repo isn't official but its so widespread its defacto.
- bobthepanda 6y agoThe problem with establishing something like a better compressed format is that 1. it needs buy in from all the browsers or it might as well be useless 2. browsers need to bend over backwards to be backwards compatible so that you can run old web pages. if a browser does not work on all the web pages a consumer needs they will simply not use it. 3. I would bet good money that most of the management in charge of the websites that make up the web would not waste dev time on migrating to some minified JS file replacement, when webpack-style minifying works "just fine" and allows your team or whatever to keep churning out new features
- randombytes6869 6y ago> I would bet good money that most of the management in charge of the websites that make up the web would not waste dev time on migrating to some minified JS file replacement, when webpack-style minifying works "just fine" and allows your team or whatever to keep churning out new features I don't think so personally. Code size is a huge issue for page performance, and a "bytecode" format would probably be 2-3X smaller and 2-3X faster to parse. Together, this might triple JS loading speed. Maybe double the loading speed of JS heavy sites. JS with sourcemaps isn't so different from compiled code with debug symbols. The sourcemap support could probably be adapted with minimal work. And its likely the transition would be transparent to most users, nobody really looks at the minified JS as it is. Another big advantage is vastly simplifying JS parsing and JIT compilation. In Java and C#, most features are added without changing the code format. And when it does get updated changes tend to be minimal. Upgrading browsers and minifiers every time JS adds a language feature is a real burden on the ecosystem