Javascript is one of the fastest dynamically typed languages. People use it instead of other languages because the productivity of dynamically typed languages is generally higher.
I’d be interested in hearing what are those other languages that would be faster to run and not slower to program in.
"Not slower to program in" is a cost savings to the business, but let's be honest about that being what it is. It's a cost savings for the business that results in a crummier product for customers. Just like trimming a single tomato from the salad on in-flight meals is a cost savings to Delta. Doesn't mean it's a "better" salad.
As far as I can tell, it's a question of having or not having whizbang bloated apps like Slack, but we had perfectly acceptable word processors, spreadsheets, 3D modeling tools, etc a long time ago. The current gen, JS-powered versions of those tools (Google Drive, Quip, Notion) all feel slower. Sure, there are fewer BSODs now so it probably evens out, but the extremely low latency UX of those tools back in the Windows 2000/XP days is lost.
Yet Figma blows Illustrator and Sketch out of the water.
A lot it’s really just down to developer talent and how much they care about it. Examples exist in the world proving it’s possible. Illustrator is slow for the same reasons, no one working on it cares about what they’re building. But still it would need 10x speed improvements in multiple areas to beat Figma now.
And Office360 is about as bad as Google Docs. It's honestly probably not a JavaScript problem. Some mixture of businesses not giving a damn about quality because it's more profitable to play the acquire-integrate-exterminate game than make quality software, lower barrier to entry meaning we get more developers who are productive because of better tooling, but probably in over their heads making performance-critical things like input controls in JavaScript, and piles of new abstractions without the old abstractions ever going away.
> the productivity of dynamically typed languages is generally higher.
This is the assumption, yes, and I am not sure that it's true at all; people simply believe it to be true rather than actually check to see if their assumptions are correct.
I believe this to be a very false assumption, in reality. The number of lines of JS that I see which do a particular thing is very high compared to other languages.
This is not a JavaScript example, but it goes to my point that our assumptions are wrong: For example, can someone explain to me why a the Dropbox Desktop client 3 years ago was 4 million lines of Python?[0] If Python is such a high-level language, why are so many lines of code needed to do such a simple thing?
The "4 million lines of Python" in that article is referring to the number of lines that are type checked (I don't see any mention of how much code remained unchecked, although the graphs might imply some 20%), but it also includes Dropbox' server side code base; the shown graphs imply that the server side is 4x larger than the client side.
Assuming the above implications are true, the client side app would be 1 million lines of code. I guess someone with the client could go and measure?
I don't mean to say that 1 M loc isn't still large, but you seem to be drawing conclusions from using numbers incorrectly.
how high-level are "high-level" languages? I would say that it would take far fewer lines of C or even Assembly to accomplish the same goals. 50k lines of C, probably. XTerm is ~70k lines of C, if I recall (I am certainly within 0.5 orders of magnitude), and it is extremely complex and does much more.
if you want a more direct comparison, look at rsync or syncthing. I haven't looked at the size of those, ever, but I'd be willing to bet that both are FAR smaller than 1M lines of code.
So, how it acceptable that a high-level language requires more lines of code than a "lower-level" language like C or Go? we're supposed to GAIN SOMETHING in the tradeoff by using high-level languages, and we're not. certainly not as much as we assume we are.
we need to pay attention to these assumptions that we're making to ensure that they're true, periodically. we're not. it's just accepted as fact that "high-level" languages require fewer lines of code and less work to produce high-quality software, and I don't think we're seeing the benefits of the tradeoff anymore, if we ever really did, outside of tiny example programs.
Who's to say? The interesting bit in this discussion is why the code size is large, and looking in detail what the programs do would be a start.
Of course, one could suppose that using a high-level language makes it easier to write code, hence, more code is going to be written. Or you or I could really conclude anything we want, if we're willing to pretend to know. It would be interesting to know, but that takes work to find out. And I'm a lazy bastard.
PS. not to argue any more :), but I have checked the size of rsync 3.2.3 now, it's 51 Kloc of C code (including the 6300 loc of the included copy of zlib). You'd need to add a cryptographic library, a GUI library, and GUI code to make it a viable replacement for Dropbox, without comparing features. Git annex 8.20210223 is 70 Kloc of Haskell and 9100 loc of JavaScript, but it depends on Git to do its work, which (version 2.30.2) is 327 Kloc of C code and 225 Kloc of sh and Perl code. Thunar 4.16.8 is 73 Kloc of C code, sshfs is 4700 loc and fuse is 22 Kloc of C, openssh is 113 Kloc of C, so maybe you could build a Dropbox replacement in 212 Kloc of C without looking through the feature set. Maybe that's still 4-5 times smaller than the Dropbox client, but your number of 50 Kloc is again off by a factor of 4. :) (I guess one could say that the truth is "somewhere in the middle", looking at those number on a logarithmic scale...)
I'm sure you could also come up with a much smaller implementation, just like you could write a music demo in 256 Bytes[1]. But why would you want to?
so, 1 billion lines of code is acceptable for a file sync tool, then, so long as other pieces of software also have that many lines? is that what you're saying? how many is too many, then? 10 billion? 1 trillion?
have you ever written software?
1 million lines of code for the Dropbox client is absolutely insane, and this is obvious to anyone who has written anything of substance. graphical libraries, security layers, it's all very simple to write stuff if you just take the time to do it. there is just nothing there worthy of 1 million lines of code, and the only way you would reach that line count is to liberally adopt hundreds or thousands of libraries so you can use a function or two from each of them (meaning: be a terrible developer who writes nothing, and only strings together the work of others)
Your comment is currently downvoted, I didn't do that (I don't even have the necessary karma yet). I'm feeling somewhat supported by that, given it seems to be questioning my judgment or my ability to write software, although maybe that's not how you've meant it.
Yes, I've written software, a few hundred Kloc over two decades. That won't look like much. I think most of my code is pretty dense, though, yes, I'm taking my time usually, and I've largely worked alone, which supports that sort of activity. I've always wondered myself how you arrive at those huge code bases. Some people (like Torvalds in earlier projects) are just much more prolific, I don't have any illusions about that. I've written both in low-level languages (C, C++, some assembly) and high-level ones (Scheme, Perl, Python, Bash, some Haskell and JavaScript), more in the latter area.
I've been able to experience that the same code written in C++ is several times (IIRC 3-4x) larger than written in Scheme (both code bases were written by me, first in Scheme to flesh out the algorithm then rewritten in C++ identically except for the memory handling). And takes even rather longer than that to write. I can also see how having a language that's easy to work with will probably lead a developer to spend their time just producing more "meat" in the same time frame, leading to the same or possibly even larger numbers of loc. I can also see how needing to care a lot about how memory is managed might lead to caring a lot about other people's code, hence, to more re-use. Code being costly to create might also give management a sense of urgency to re-use it, or reduce the amount of it being written. But all of those points are just conjectures, I don't have any data on them. But it's interesting conjectures and I'm with you on them.
What I was, or meant to be, saying, is that we need more details and be careful about conclusions. Ranting about bloat is common, it seems fashionable, and there surely is truth about it having real downsides, and it may be right to try to get the world to care, but if one wants to influence anything, one needs to know the details. Already the label bloat itself is up to interpretation: is e.g. embedding a framework to serve ads bloat (a user would likely say yes) or essential (some businesses will say yes)? Is the feeling of drowning in bloat coming from the recent tendency of Windows doing too much undesired activity (again, probably warranted)?
I didn't mean to ridicule you by posting the link to the demo. I was making fun of our often present (shared?) desires of producing beautiful, small code--and the applicability to real-world money-making work. I might be proud if I can produce small code, but the business may very well not care at all (rightly so if it's at such extremes). As you say it takes time to write shorter code, and that has to pay off. Doing it any other way would not be smart. So, there must be a value to reduce code size, and what that is exactly is one of those details we're not talking about. So I've posted the link to say, hey, you could write such code, if you wanted--the question is just, do you want to? Does the business want to? Why, or why not? That's the interesting question, I think. And I was just correcting you on the numbers that you were posting.
I’d be interested in hearing what are those other languages that would be faster to run and not slower to program in.