38 ms·
Skeptical of rewriting JavaScript tools in "faster" languages
- bryanrasmussen 2y agothe big issue here is the debuggability by having all your dependencies in the same language, and it's not even like these rewrites will all be in the same performant language for you to learn, so essentially if you are using a wasm compiled dependency you are not likely to be able to go into that dependency's code and figure out where the library author has messed up or what you have misunderstood from the documentation.
- Kinrany 2y agoThe solution to that is dependencies that work
- bawolff 2y agoDoes the dependency that always works and has no bugs also come with a free rainbow and unicorn?
- bryanrasmussen 2y agoI sure hope so - otherwise how would I know the dependency I installed was going to always work?
- worthless-trash 2y agoAsk the unicorn.
- bryanrasmussen 2y agoexactly, which is why I was hoping I would get one?
- Kinrany 2y agoDependencies should be small and focused. When scope is limited, it's not rocket science to write implementations that have very few bugs.
- keybored 2y ago[flagged]
- deleted 2y ago[deleted]
- bawolff 2y agoYeah, i agree. I think there is a time where rewriting in a faster language is useful (just like how handcrafted assembly is still a thing), but most of the time you are very far away from the point where that is neccesary. I also think there is an element of, "rewrite in rust" is just easy to say, where changing data structures or whatever requires analysis of the problem at hand.
- MrHamburger 2y agoIt is analogues discussion to C vs Rust. Sure Rust is memory safe, but whole ecosystem I am using today is C based. Compiler, SDK, drivers, RTOS, ... Nobody sane is going to rewrite it for the sake of rewriting it into a different language.
- bawolff 2y agoI would disagree with that comparison. Rust really does provide an improvement in memory safety that is hard to achieve by other means. That's not to say you should always rewrite in rust, there are plenty of situations where that doesn't make sense. However its not analgous to the performance situation in my opinion.
- jongjong 2y agoI also love JavaScript. It's true, it has some really bad parts but you can avoid them. If I could design the perfect language for myself, it would have the syntax of JavaScript and the portability of JavaScript but it would use Python's strong duck typing approach.
- anyfoo 2y agoWhat have static type systems ever done to you, that you avoid them so much?
- bryanrasmussen 2y agomost static type systems are verbose, probably due to linguistic verbosity, so one obvious thing that static type systems have probably done to a lot of people is given them pain from typing so much.
- anyfoo 2y agoI don't feel it's so much typing. Especially for the clarity and, most importantly, safety and correctness I get back. I'd rather type 3 1/2 seconds more than debug a dumb type issue for half an hour. It gets really old to get something like "NoneType does not have blah" in a deeply nested, complicated data structure in python, but obviously only at runtime and only in that hard to hit corner case, when all you did is forget to wrap something in the right number of square brackets in some other part of the code. I haven't fully given up on python, but I only deal with it using mypy, which adds static typing, anymore.
- jwells89 2y agoA bit of extra verbosity as added by static typing can also be immensely helpful for trawling through and/or learning an unfamiliar codebase, especially in the absence of an IDE or debugging environment (e.g. browsing code on GitHub or in a filemanager). For instance, take function definitions. By just adding types to the function's arguments, you're potentially saving the reader a ton of time and mental overhead since they don't have to chase down the right the chain of function calls to figure out what it is exactly (or is supposed to be) that's getting passed in.
- jpalawaga 2y agoAnyone who has done a programming contest, advent of code, etc knows that the language doesn’t matter so much as your algorithm. Yes, the language can bring a nice speed up, or might give you better control of allocations which can save a lot of time. But in many cases, simply picking the correct algorithm will deliver you most of the performance. As someone who doesn’t JavaScript a lot, I’d definitely prefer a tool written in go and available on brew over something I need to invoke node and its environment for.
- tyree731 2y agoLots of very smart people have worked very hard on Python tools written in Python, yet the rust rewrites of those tools are so much faster. Sometimes it really is the programming language.
- anyfoo 2y agoChoosing the right algorithm effectively means optimizing runtime complexity. Then, once runtime complexity is fixed with the right algorithm, you're still left with a lot of constant factors that O-notation deliberately ignores (it's only about growth of the runtime). Sometimes, optimizing those constant factors can be significant, and then the choice of language matters. And even some details about the CPU you are targeting, and overall system architecture.
- o11c 2y agoOften languages like Javascript and Python don't allow optimal runtime complexity, because the types baked in to external interfaces fundamentally disallow the desired operation. And these languages are too slow to rewrite the core logic in the language itself. (but of course, the vast majority of the code, even in widely used tools, isn't properly designed for optimization in the first place) I only dabble in javascript, but `tsc` is abominable.
- charrondev 2y agoIn the JavaScript world a lot of speed up comes from 3 major things as far as I can tell: - easier concurrency. - the fact that things are actually getting rewritten with the purpose of speeding them up. - a lot of the JS tooling getting speedups deals with heavily with string parsing, tokenizing, generating and manipulation of ASTs. Being able to have shared references to slices of strings, carefully manage when strings are copied, and have strict typing of the AST nodes you enable things to be much faster than JavaScript.
- anyfoo 2y ago> I’ve written a lot of JavaScript. I like JavaScript. And more importantly, I’ve built up a set of skills in understanding, optimizing, and debugging JavaScript that I’m reluctant to give up on. It's not that hard to do the same for a less terrible language. Choose something markedly different, i.e. a low level language like rust, and you will learn a lot in the process. More so because now you can see and understand the programming world from two different vantage points. Plus, it never hurts to understand what's going on on a lower level, without an interpreter and eco-system abstracting things away so much. This can then feed back into your skills and understanding of JS.
- FridgeSeal 2y agoI swear some JS devs will go out of their way to avoid learning anything else, whilst simultaneously and breathlessly espousing that we rewrite everything else in JS.
- oneweekwonder 2y ago> Any application that can be written in JavaScript, will eventually be written in JavaScript. - Jeff Atwood (2007)
- peutetre 2y agoThe game is changing with WebAssembly though. Large JavaScript applications are replacing JavaScript bits with wasm: https://web.dev/case-studies/google-sheets-wasmgc https://web.dev/case-studies/google-sheets-wasmgc Any application that is written in JavaScript will have more and more of it replaced with WebAssembly.
- wiseowise 2y ago> Any application that is written in JavaScript will have more and more of it replaced with WebAssembly. Which is not a lot when it comes to web. Sure some algo heavy stuff like Figma will benefit from it, but GUI around it is still written in what?
- noname120 2y ago> I just don’t think we’ve exhausted all the possibilities of making JavaScript tools faster Rewriting in more performant languages spares you from the pain of optimization. These tools written in Rust are somehow 100× as fast despite not being optimized at all. JavaScript is so slow that you have to optimize stuff, with Rust (and other performant languages) you don't even need to because performance just doesn't bubble up as a problem at all, letting you focus on building the actual tool.
- evanjrowley 2y ago>JavaScript is so slow that you have to optimize stuff This raises the question, is JavaScript more prone to premature optimization?
- noname120 2y agoWell, can we really call it premature optimization if it's needed?
- dpritchett 2y agoReminds me of using Ruby ten years ago and having to contend with folks who wanted to default to using the string literal style over another because it was known to be more performant at scale. That awkward stuff surfaces earlier with some languages than with others.
- robinsonrc 2y agoI guess if folks write JS with the idea that optimisations are needed in mind, then the chances of premature optimisations may go up along with those of the required ones
- ignoramous 2y agoBeing a statically-typed compiled language has its perks (especially when doing systems programming). Regardless, JS runtimes can and will push forward (like JVM / ART did), given there's healthy competition for both v8 & Node.
- paulddraper 2y agoThe biggest reason to be skeptical is that these tools are not open to extension in the same way that JavaScript is. Webpack has an enormous community of third-party plugins, it would be very hard to do something similar with e.g. Go or Zig.
- klabb3 2y agoRight, because tooling is standardized in eg Go. There’s no custom build pipeline, transpilation hell, or experimental language features that are selectively enabled randomly. I’m not even against JS, like at all, and I think the majority of perf issues can be resolved. However, JS tooling is the prime example of where things get truly nightmarish from a software development perspective. Webpack being a perfect example of this horror.
- postalrat 2y agoIt's also a breeding ground where the best ideas often end becoming a sort of standard not only for javascript devs but for other langauges as well.
- FridgeSeal 2y agoWell curious as to what some of these ideas might be. NPM has done a pretty great job of showing everyone else what to avoid doing. The mere mention of “web pack” sends most of the FE devs I’ve met into borderline trauma flashbacks. There’s seemingly half a dozen package managements tools, some of which also seem to be compilers? There’s also bundlers, but again some of these seem integrated. Half of the frameworks seem to ship their own tools?
- paulddraper 2y agoYou can ship a 20MB Go program and no one blinks. Go programs start at 20MB. The Go AWS Terraform provider is something like 300MB. A massive amount of the complexity/difficulty in webdev build tools space has to with optimizing delivery sizes on the web platform. Node.js tooling is straightforward comparatively.
- qianli_cs 2y agoI'm not sure if JavaScript supports it, but some Python libraries allow you to choose whether to install a more optimized binary version or the pure Python implementation. For example, if you install psycopg you'll get a pure Python implementation which is easy to debug and hack. But you can also install psycopg[binary] to obtain a faster, compiled version of the library. https://www.psycopg.org/psycopg3/docs/basic/install.html https://www.psycopg.org/psycopg3/docs/basic/install.html
- jampekka 2y agoThat typically means two totally different implementations, and pure Python versions are often unusably slow, so it doesn't help much to hack that.
- sksxihve 2y ago> Whereas if it’s written in a native language, I’d need to check out the source code and compile it myself – a big barrier to entry. Is it though? Rust/Zig/Go programs are pretty much all incredibly easy to checkout and compile, it's one of the big selling points of those languages. And at the end of the day how often are javascript developers fixing the tooling they use even when it's written in javascript? I've always felt learning new languages give me not only new tools to use but shapes the way I think about solving problems.
- timeon 2y agoI wonder if author is aware that Node.js is not written in JavaScript.
- zero_shift 2y agoProbably: he is a contributor to Servo
- claytongulick 2y agoIt depends. A lot of it absolutely is, I've been through a ton of that source. Low level stuff is mostly c++ to talk to v8 or do system calls, talk to libuv, etc... but even that stuff has a bunch of js to wrap and abstract and provide a clean DX.
- M4v3R 2y agoI agree with you on the easy part, but it’s definitely not as fast. In JS you get instant hot code reload and even without that the interpreter starts up pretty fast. In comparison Rust takes a while to recompile even with simple changes, and if you have more changes in many files (eg. switching between branches) then it’s really slow.
- mtndew4brkfst 2y agoThis matters, a lot, for contributing to the tool authored in Rust. But for merely installing and benefiting from it, compile-time is largely a one-time cost that pays returns quite soon.
- from-nibly 2y ago> It’s very forgiving of types I lost you here. JavaScript doesn't work around type issues, no language really can. It just pushes the type issues to a later time.
- nickserv 2y agoIndeed, and later on in the same sentence: > this is one reason I’m not a huge TypeScript fan Sorry but TS is the only thing making the JS ecosystem palatable. So many bugs caught thanks to typing...
- porcoda 2y agoSometimes it seems that people who write these kinds of pieces forget that not everyone in the world does web or even web-adjacent work, and node.js is something we don’t even consider to be part of our ecosystem. Rewriting useful things in non-JS has the benefit of letting folks like me who avoid JS like the plague use useful tools. Stop assuming everyone wants to get anywhere near the JS ecosystem: I’ve gone 30 years without touching it, and plan to continue that streak. Rewriting stuff is great from my perspective.
- worik 2y ago> Stop assuming everyone wants to get anywhere near the JS ecosystem I have been dragged, through straight misrepresentation, into the Node.js world. OMG, awful hardly begins to touch it. I have not used Go, but as far as I can tell every thing the Node.js people do is done better in Go. I do not recommend Rust. I have a lot of experience with Rust, and unless you actually need the real time responsiveness it will bog you down.
- namuol 2y ago> Stop assuming everyone wants to get anywhere near the JS ecosystem The author is writing about JS ecosystem tools.
- warpspin 2y agoI can partly understand the poster above: Some people (including me) for example want and have to use JavaScript, but simply don't want to get dragged into that whole node.js/npm ecosystem for various reasons. I avoid any tool which forces me to pull in a gazillion npm packages, while I gladly use esbuild for example because it looks and feels like a nice little compact tool.
- namuol 2y agoI feel the same way about python, but I don’t blame python authors for using the python ecosystem to write python tools when I am forced to use a little python. I consider python to be an essential part of any build system since it’s used in so many places, as much as I don’t like it. Maybe the problem people have is that node/npm are becoming a similarly “essential” build system piece much like python. That much I can certainly understand.
- cyberax 2y ago> For another thing: it’s straightforward to modify JavaScript dependencies locally. I’ve often tweaked something in my local node_modules folder when I’m trying to track down a bug or work on a feature in a library I depend on. Whereas if it’s written in a native language, I’d need to check out the source code and compile it myself – a big barrier to entry. Yeah, JavaScript is sloppy, but you can always monkey-patch it by modifying tool-controlled files. Great idea. Not. JS is just not a good language. The JIT and the web of packages made it slightly more usable, but it's still Not Good. There's no real way to do real parallel processing, async/await are hellish to debug, etc. It's unavoidable in browsers, but we _can_ avoid using it for tools. Look at Python, a native PIP replacement improved build times for HomeAssistant by an order of magnitude: https://developers.home-assistant.io/blog/2024/04/03/build-images-with-uv/ https://developers.home-assistant.io/blog/2024/04/03/build-i...
- eviks 2y ago> Whereas if it’s written in a native language, I’d need to check out the source code and compile it myself – a big barrier to entry. Or you could use the source code already downloaded by a package manager and do similar tweaks locally with the build manager picking them up and compiling for you
- metadat 2y ago> I should also acknowledge: there is a perf hit from using Wasm versus pure-native tools. So this could be another reason native tools are taking the CLI world by storm, but not necessarily the browser frontend. I didn't know about this before, I wonder how much overhead? The reason I am reluctant to rely on JS tools for anything CLI is because of Node.js instability due to version sensitivity and impossible-to-fix-without-reinstalling-the-os low level LibC errors. Compared to go, rust, or python, the odds that any given CLI.js program will run across my (small) fleet of machines is very low, by factor or 10x or more compared to alternatives. Some boxes I don't want to reinstall from scratch every 4 years, they're not public facing and life is too short.
- lenkite 2y agoDeno is fixing this with their standard library and JSR.
- csomar 2y agowasm itself is a bit slower than code compiled for a particular CPU. However, there is significant overhead when it comes to the browser. This is because, now, wasm has to use JavaScript to talk to the browser. The performance gain/loss will depend on the type of operations you are doing. There are plans, however, for wasm to have direct access.
- a_wild_dandan 2y agoI’m continually surprised at JavaScript’s speed. Seeing JS sometimes nipping at the heels of C/rust/etc in performance benchmarks blows me away. V8 is such an incredible piece of engineering. In my work, it’s hard to justify using something other than JS/TS — incredible type system, fast, unified code base for server/mobile/web/desktop, world’s biggest package ecosystem for anything you need, biggest hiring pool from being the best known language, etc. It’s just such a joy to work with, ime. Full-stack JS has been such a superpower for me, especially on smaller teams. The dissonance between how the silent majority feels about JS (see, e.g the SO yearly survey), vs the animus it receives on platforms like HN is sad. So here’s my attempt at bringing a little positivity and appreciation to the comments haha.
- ivanjermakov 2y agoI want more people to understand how much people are working on JS performance. Google, Apple, Microsoft, Mozilla - all have incentive to make it as fast as possible. Too bad JS is not the best candidate for many optimizations. I wonder if we'll get to the point of having a compiled version of JS that allows more static optimizations to be done. WebAssembly might occupy that niche if it gets nice standardized runtime.
- andrewstuart 2y agoYou could try the quickJS compiler. https://bellard.org/quickjs/quickjs.html#qjsc-compiler-1 https://bellard.org/quickjs/quickjs.html#qjsc-compiler-1
- fredrikholm 2y agoIt's important to recognize how seldom this carries out in practice. I've rewritten some ~10 small node servers to Go, Java and C#, and they've always been >10X faster without changing algorithms. Even in the few cases where dynamic languages catch up, they're often written in an unidiomatic style (read: optimized) and compete with unoptimized/naive C/C++.
- musicale 2y agoJavaScript is a terrific language: more ubiquitous than BASIC ever was; nearly as easy to learn and use as Python; syntax that is close to Java/C/C++. And it only uses 10x the CPU and memory of C or C++.
- cxr 2y agoThis, like most articles dealing with "JS", is really more about the things you'll find yourself futzing around with when you're in the NodeJS and NPM ecosystem. You wouldn't conflate Windows development with "C" (and completely discount UNIX along the way) just because of Win32. But that's about how bonkers it is when it comes to JS and people do the same with its relationship to Node—not only was JS not created to serve the Node ecosystem, the prescriptions that NPM and Node programmers insist on often cut against the grain of the language. And that's just when we're focused on convention and haven't even gotten to the outright incompatibilities between Node and the language standard (or Node's proprietary APIs). node_modules, for example? That has fuck-all to do with ECMA262/JS. Tailwind, Rollup, Prettier, all this other stuff—even the misleadingly named ESLint? Same. You're having a terrible experience because you're interacting with terrible software. It doesn't matter that it's written in JS (or quasi-JS). Rewrite these implementations all in other languages, and the terrible experience will remain. Besides, anyone who's staking out a position that a language is slow, and that JS is one of them is wrong two ways, and you don't have to listen to or legitimize them.
- deleted 2y ago[deleted]
- leerob 2y agoIf you want to steel man _for_ writing in Rust or Zig or Go, previous discussion here: https://news.ycombinator.com/item?id=35043720 https://news.ycombinator.com/item?id=35043720
- al2o3cr 2y agoIMO the biggest win when Phoenix switched to esbuild wasn't about _speed_ exactly, it was about not having to install&debug things like node-gyp just to get basic asset bundling going.
- williamstein 2y agoI recently discovered Rspack, which is a compatible rewrite of Webpack in Rust by a guy at ByteDance. It is genuinely 5x-10x faster across the board on my large/complicated project. I've been using Webpack for 8 years, and I was absolutely blown away to be able to easily swap Webpack out for something so similar (written in Rust) and get such a massive performance improvement. This has made my life so much better.
- kristianp 2y agoCan you now write client and server js code without installing npm? I guess you'd be reinventing a lot of wheels that the packages provide.
- wiseowise 2y agoYou can already do that if you don’t need bundling and transpilation.
- simultsop 2y agoWhile the skeptical's stall in decision making, new comers who do not think twice about rewriting. Rewrite software on a smaller budget in experimental attempts. Then management decides to chose the cheaper option available, because lean startup is promising. Then in next 10 years the new comers become the new skepticals. I don't know if there's a case that this cycle is not repeated, at any time frame.
- gwerbret 2y agoI've read your comment several times and still don't know what it means. Can you clarify?
- strken 2y agoI've rewritten it for clarity: "While the skeptics stall in decision making, newcomers will not think twice about rewriting software on a smaller budget as an experiment. Then management will decide to choose the cheapest option available, because the lean startup was more competitive. Then in the next 10 years, the newcomers become the new skeptics. In my experience this cycle is always repeated, albeit across different time frames." I made the difficult choice to rewrite it in English again, even though French might have been more performant.
- deleted 2y ago[deleted]
- deleted 2y ago[deleted]
- simultsop 2y agoThank you so much, you taught me how to express this "albeit across different time frames". It is difficult to use any language to simplify complex narrations.
- simultsop 2y agoImagine developers as the choosing (management) part and if you are involved with webdev in last decade. Compare webpack and vite. As pricing parameter consider the time to bundle (faster=cheaper). So, what webpack did not do by not rewriting itself, vite came in offering.
- hresvelgr 2y ago[flagged]
- davedx 2y agoI’ve worked on some huge nodejs projects, it’s a great language for “serious projects”. It has costs and benefits like any other language. If you use TypeScript then IME many of the costs are mitigated. What exactly makes JavaScript so unsuitable?
- hresvelgr 2y ago> What exactly makes JavaScript so unsuitable? Pretty much all the usual, boring offenders everyone's familiar with: truthy/falsey, errors passing silently, exceptions, and differences in importing behaviour with bundlers and runtimes. These things are admittedly quite simple to fix when it's your code, but when you multiply that by 1000 dependencies, which is a conservative number for a JS project a whole host of difficult to detect issues will rear over time. > If you use TypeScript then IME many of the costs are mitigated. TS meaningfully helps, but it still falls short of the mark imho. Turning on 99% of TS lints to error is the only solid way I've found to prevent a lot of the issues I've encountered. But that's really hard to introduce into existing codebases. It's doable, but with a lot of friction and effort.
- helltone 2y agoIn addition to what is mentioned by the other comment, also threading and io.
- rob74 2y ago> What exactly makes JavaScript so unsuitable? If you look at JavaScript's history (especially for backend development), it reads like a series of accidents: First, the JS language was hacked together at Netscape in the space of a few months in 1995, and after that it was quickly baked in into all web browsers and therefore became very hard to change in a meaningful way. Then, Google developed the V8 engine for Chrome, and someone thought it would be a great idea to use it for running JS in the backend. My thoughts on that were always: "just because you can do something doesn't mean that you should"...
- eviks 2y ago> One reason for my skepticism is that I just don’t think we’ve exhausted all the possibilities of making JavaScript tools faster. Exhausting is very exhausting, so at a fraction of that effort you could build on better foundations
- Jean-Papoulos 2y agoThis guy is not competent to talk about what he's talking about. >"JavaScript is, in my opinion, a working-class language. It’s very forgiving of types (this is one reason I’m not a huge TypeScript fan)." Being "forgiving of types" is not a good thing. There's a reason most "type-less" languages have added type hints and the like (Python, Typescript, etc) and it's because the job of a programming language is to make it easier for me to tell the CPU what to do. Not having types is detrimental to that.
- Doxin 2y ago> There's a reason most "type-less" languages have added type hints and the like (Python, Typescript, etc) I would like to clarify that even without typing python is a LOT less "forgiving of types" than javascript. It has none of the "One plus object is NaN" shenanigans you run into with javascript.
- makapuf 2y agoTypes are guidelines and strictly useful and a good thing. That said, one can wonder why languages like basic, python, scheme or php (dynamic, implicit types) have grown popular. Maybe for bad reasons but there IS an added value for implicit types. C++ (maybe even C !) has grown the auto keyword and other typed language have type inference. Which is not the same as "typeless" (it always is typed) but it defeats one of the "double check" security of types. And it's sometimes not needed (yes, if I initialize it with "abc" it may be a string)
- tugberkk 2y agosure. one is strongly typed and the other weakly typed.
- thefroh 2y agowhile I'm a fan of TypeScript and using type hints in Python from an autocomplete and linting perspective, I am curious... ... has either language leveraged these to better tell the CPU what to do? presumably for perf.
- thomasvogelaar 2y agoI don't buy the argument that a lot of the performance jumps from rewrites comes from developers writing more optimised code. I've worked on multiple rewrites of existing systems in both JS and PHP to Go and those projects were usually re-written strictly 1:1 (bugs becoming features and all that). It was pretty typical to see an 8-10x performance improvement by just switching language.
- xandrius 2y agoExactly the same experience. For a smallish batch processing script I had written in node, I just fed it to chatgpt and got the golang version. It went from being unusable with over 100K records to handling 1M on exactly the same machine. And only then I started adding things like channels, parallelism, and smart things.
- thomasvogelaar 2y agoNow that there's no perfect parity to maintain we've started optimising the Go versions as well. Multiple 2x performance improvements once we started doing this, on top of the original performance improvements. This translates to insane cost savings when you're working at scale.
- Joker_vD 2y agoYeah, it reminds me about all those old "Haskell can be faster than C!" posts that used to be very popular. Sure, some exquisite, finely-crafted Haskell code can be faster than a plain, dumb, straightforward, boring C code. But if you compare plain, dumb, straightforward, boring Haskell code with plain, dumb, straightforward, boring C code, the latter will be faster pretty much always.
- nineteen999 2y agoPlus it will be readable by a much larger percentage of working programmers.
- 2y ago
- GianFabien 2y agoSeems to me that the article and many of the comments conflate JS with Node. Personally I abhor Node and work with both Bun and Deno. In both cases avoiding the Node compatible bits.
- pzo 2y agoHere you have benchmark of programming languages: https://benchmarksgame-team.pages.debian.net/benchmarksgame/ https://benchmarksgame-team.pages.debian.net/benchmarksgame/ On top of that some languages don't have support for SIMD/NEON and parallel libraries or GPU processing libraries - those things can significantly improve performance
- deleted 2y ago[deleted]
- steve_adams_86 2y agoI’ve written quite a bit of tooling in JS, and I genuinely enjoy the language, but I feel like Rust and Go are a godsend for these types of tools. I will sometimes prototype with TypeScript, but if something requires massive concurrency and parallelism, it’s unlikely I’ll stick with it. I wonder if the author would feel differently if they spent more time writing in more languages on tooling like this. My life got a lot easier when I stopped trying to write TypeScript everywhere and leveraged other languages for their strengths where it made sense. I really wanted to stick to one language I felt most capable with, but seeing how much easier it could be made me change my mind in an instant. The desire for stronger duck typing is confusing to me, but to each their own. I find Rust allows me to feel far, far more confident in tooling specifically because of its type system. I love that about it. I wish Go’s was a bit more sane, but there are tons of people who disagree with me.
- cies 2y agoI also though rewrites of JS projects were only in part motivated by perf gain. Sure they were the most advertised benefits of the rewritten tools, as that communicates a benefit for the users of those tools. > I find Rust allows me to feel far, far more confident in tooling specifically because of its type system. Usually the JS projects become really hard to work on the growing up. Good JS needs a lot of discipline on the team of devs working on it: it get messy easily and refactoring becomes very hard. Type systems help with that. TypeScript helps, but only so much... Going with a languages that both has a sound type system (like Rust) and allows lots of perf improvements (like Rust) becomes an attractive option.
- bluGill 2y ago> The desire for stronger duck typing is confusing to me, but to each their own I really like duck typing when I'm working on small programs - under 10,000 lines of code. Don't make me worry about stupid details like that, you know what I mean so just do the $%^#@ thing I want and get out of my way. When I work with large programs (more than 50k lines of code - I work with some programs with more than 10 million lines and I know of several other projects that are much larger - and there is reason to believe many other large programs exist where those who work on them are not allowed to talk about them) I'm glad for the discipline that strong typing forces on me. You quickly reach a point in code where types save you from far more problems than their annoyance costs.
- stabbles 2y agoWhat makes me skeptical is reading > I just don’t think we’ve exhausted all the possibilities of making JavaScript tools faster and then > Sometimes I look at truly perf-focused JavaScript, such as the recent improvements to the Chromium DevTools using mind-blowing techniques like using Uint8Arrays as bit vectors, and I feel that we’ve barely scratched the surface. Bit vectors are trivial? I think the author is too ignorant about those "faster languages". Sure, maybe you can optimize javascript code, but the space of optimizations is only a small subset of what is possible in those other languages (e.g. control over allocations, struct layout, SIMD, ...)
- deleted 2y ago[deleted]
- gagaq 2y agoIf JS runtimes take type hints into consideration, then they can be much faster. SIMD is not really hard to support, though value types can be hard to retrofit.
- speedypypy 2y agoI find PyPy gives me enough speedup for my Python scripts to leave it.
- kookamamie 2y ago> That said, I don’t think that JavaScript is inherently slow, That said, I don't think the author understands performance when it comes to language details. There are several layers of untapped performance, all which JS makes hard to access - optimal vectorization, multi-threading, memory/cache usage, etc.
- deleted 2y ago[deleted]
- roca 2y agoI think the importance of parallelism has been overlooked by the OP and most commenters here. Even laptops these days have at least 8 cores; a good scalable parallel implementation of a tool will crush the performance of any single-threaded implementation. JS is not a great language for writing scalable parallel code. Rust is. Not only do Rust and its ecosystem (e.g. Rayon) make a lot of parallel idioms easy, Rust's thread safety guarantees let you write shared-memory code without creating a maintenance nightmare. In JS you can't write such code at all. So yes, you can do clever tricks with ArrayBuffers, and the JS VMs will do incredibly clever optimizations for you, but as long as your code is running on one core you cannot be competitive. (Unless your problem is inherently serial, but very few "tool"-type problems are.)
- deleted 2y ago[deleted]
- nine_k 2y agoOTOH in production settings you can run 6-8 copies of your Node app to utilize the 8 physical CPU cores without (much) contention; the JS engine runs additional threads for GC and other housekeeping. Or you can use multiple "web workers" which are VM copies in disguise. The async nature of the JS runtime may allows for a lot of extra parallelism (for waiting on I/O completion) on one core if your load is I/O-bound, as it is the case for most web backends. Th same does not hold for frontend use, as it's for one user, and latency trumps throughput in the perception of being fast. You need great single-thread performance, and an ability to offload stuff to parallel threads where possible, to keep the overall latency low. That's basically the approach of game engines.
- chrismorgan 2y agoWhen talking about tooling: around five years ago, I introduced parallelism to a Node.js-based build system, in a section that was embarrassingly parallel. It was really painful to implement, made it noticeably harder to maintain, and my vague memory is that on an 4-core/8-thread machine I only got something like a 3–4× speedup. I think workers are mature enough now that it wouldn’t be quite so bad, but it would still be fairly painful. In Rust, I’d have added Rayon as a dependency to my Cargo.toml, inserted `use rayon::prelude::;` (or a more specific import, if I preferred) into my file, changed one `.iter()` to `.par_iter()`, and voilà, it’d have compiled (all the types would have satisfied Send) and given probably at least a 6–7× speedup. Seriously, when you get to talking about a lot of performance tricks and such (I’m thinking things like the bit maps referred to at the end), even when they’re possible* in JavaScript, they’re frequently—I suspect even normally—way easier to implement in Rust.
- austin-cheney 2y agoThe sentiment of the article is 90% right. In all fairness there are opportunities for making tools faster by writing them in faster languages, but these tend to be extreme scenarios like whether you really need to send 10 million WebSocket messages in the fastest burst possible. Aside from arithmetic operations JavaScript is now as fast as Java and only 2-4x slower than C++ for several years now and it compiles almost instantly. Really though, my entire career has taught me to never ever talk about performance with other developers... especially JavaScript developers or other developers working on the web. Everybody seems to want performance but only within the most narrow confines of their comfort zone, otherwise cowardice is the giant in the room and everything goes off the rails. The bottom line is that if you want to go faster then you need to step outside your comfort zone, and most developers are hostile to such. For example if you want to drive faster than 20 miles per hour you have to be willing to take some risks. You can easily drive 120 miles per hour, but even the mere mention of increased speed sends most people into anxiety apocalypse chaos. The reactions about performance from other developers tend to be so absolutely over the top extreme that I switched careers. I just got tired of all the crying from such extremely insecure people who claim to want something when they clearly want something entirely different. You cannot reasonably claim to want to go faster and simultaneously expect an adult to hold your hand the entire way through it.
- dartos 2y agoBut build tools in js land are quite slow. Especially when you start throwing behemoths like Nx in the mix. Look at the performance gains in build tool land (esbuild specifically) and you’ll see the performance gains with native languages. For most webservers and UIs it’s plenty fast though.
- WorldMaker 2y agoMuch of esbuild's performance gains are in throwing out a lot of cruft. It definitely benefits from the "fresh rewrite can avoid the cruft of an organic project", including specifically benefiting a lot from ESM as the winning end goal format, and the hindsight of Webpack eventually a massive organic ecosystem of plugins towards a core set of "best practices" over a lot of versions and ecosystem churn. esbuild versus webpack performance is never a fair fight. Most of the other behemoths are still "just" webpack configurations plus bundles of plugins. It will take a while for the build tools in that model to settle down/slim down. (esbuild versus Typescript for "Typescript is the only build tool" workflows is a much more interesting fight. esbuild doesn't do type checking only type stripping so it is also not a fair fight, and you really most often want both, but "type strip-only" modes in Typescript are iterating to compete with esbuild in fun ways, so it is also good for the ecosystem to see the fight happening.) I appreciate esbuild, but I also appreciate esbuild had so much of the benefit of a lot of hindsight and not developing in the open as an ecosystem of plugins like webpack did but rather baking in the known best practices as one core tool.
- greybox 2y agoI kind see the points he´s making, however I think there's something subtle here that's worth talking about: > Rather than empowering the next generation of web developers to achieve more, we might be training them for a career of learned helplessness. Imagine what it will feel like for the average junior developer to face a segfault rather than a familiar JavaScript Error. I feel this slightly misses the point. We should be making sure that the next generation of Software Engineers have a solid grounding in programing machines that aren't just google's V8 Javascript Engine, so that they are empowered to do more, and make better software. We should be pushing people to be more than just Chrome developers. Also, while I understand what the author is getting at, referring to lower level developers as demigods is a little unhelpful. As someone who switched careers from high-level languages to a C++ engineer, I can attest to the fact that this stuff is learnable if you are willing to put the time and effort in to learning it. It's not magic knowledge. It just takes time to learn.
- rob74 2y agoIn my experience with Node, these "familiar JavaScript errors" were extremely cryptic and had little to do with the actual issue most of the time. And talking about segfaults is pure FUD - it's not as if a build tool written in another language will throw a segfault at you if your JS code is broken. And if it does, you should file a bug report - same as you would for Node (maybe some JS developers have the knowledge to hunt for bugs in JS-written build tools, but I doubt even those have a particular desire to actually do it).
- prewett 2y agoSegfaults are the easy bugs! You get a handy stack trace right where the problem is, all the variables intact, it's great! It's the ones where you mess up a data structure, or overwrite an array that kill you, with the symptom occurring long after the problem was caused. Much like React, in fact, where problems in React usage don't get reported until the event loop, long after your function creating your component has finished executing. So maybe those developers will be right at home after all.
- ossobuco 2y agoOr, you know, use a language that doesn't require all of that tooling? It might seem like blasphemy but hear me out, I've worked in web dev for 10 years, now developing a game in the Odin lang for a few months. It's incredible how I don't need tooling at all, except for a basic IDE integrated language server. No package manager, no transpiler, no linter/formatter, no extensive configuration files. Need to add a dependency? Just copy paste the code you need from a github repo. It's still readable and editable if you need since it's the source code, not some transpiled/minified/optimized mess. Ever had ESM/CommonJS dependencies conflicting with your tsconfig.json, right when you need to deploy an urgent hotfix? Forget about that madness. It is such a great and simple DX compared to JS. Edit: Before I'm dismissed, I'll add that my Odin project is becoming as complex as any other JS website I've worked on and it can run in a browser thanks to wasm compilation. So I'm not even comparing apples and oranges.
- peutetre 2y agoWith WebAssembly getting better both on the client side and the server side, when WebAssembly achieves better performance than JavaScript, and when with WebAssembly you have the opportunity to use almost any other language, why would you use JavaScript?
- bastawhiz 2y agoOn the server, you wouldn't choose wasm, you'd choose a language that compiles to wasm. Which is really just saying "choose another language": there's no point in compiling (e.g.) Rust to wasm just to run it with Node on the server.
- peutetre 2y agoYou'd choose wasm on the server if you're using a framework that supports it. For example: https://blog.nginx.org/blog/server-side-webassembly-nginx-unit https://blog.nginx.org/blog/server-side-webassembly-nginx-un... https://github.com/WebAssembly/wasi-http https://github.com/WebAssembly/wasi-http Write in any language, compile to WebAssembly, have it run on the server no matter what the server's CPU architecture, achieve better performance with high compatibility.
- bastawhiz 2y agoWhy in the world would you compile to wasm and make your code slower instead of just compiling to native code? To your example: you don't need nginx to talk to wasm, it already talks to your code running on a local socket. The only reason for wasm is portability. If you can't compile your code for the server you're going to be running it on, then the original argument of choosing wasm over JavaScript is already moot.
- peutetre 2y ago> instead of just compiling to native code? Because the managed service you signed up to doesn't offer that to you. They like WebAssembly modules because it's a sandboxed runtime.
- LordHeini 2y agoAs someone who as written a lot of Go and trained a couple of people in it. The "more difficult" in this quote makes me somewhat angry. `This breaks down if JavaScript library authors are using languages that are different (and more difficult!) than JavaScript.` JS is absolutely not easy! It is not class oriented but uses funky prototypes, it has classes slapped on PHP-Style. Types are bonkers, so someone bolted on TypeScript. It has a dual wield footgun in the form of null/undefined, a repeat of the billion dollar mistake but twice! The whole Javascript tooling and ecosystem is a giant mess with no fix in sight (hence all the rewrites). The whole JavaScript ecosystem is ludicrously complicated with lots of opinions on everything. Tooling is especially bad because you need a VM to run stuff (so lots of rewrites). This is why Java never got much traction in that space too. Go for example is way easier to learn than Javascript. Here i mean to a level of proficiency which goes beyond making some buttons blink or load a bit of stuff from some database. Tooling just works. There is no thought to spend on how to format stuff or which tool to use to run things. And even somewhat difficult (and in my opinion useless) features like classes are a absent. Want to do concurrency? Just to `go func whatever()`. Want it to communicate across threads? Use a channel it makes stuff go from A -> B. Try this in JS you have to know concepts like Promises, WebWorkers and a VM which is not really multithreaded to begin with.
- WD-42 2y agoAgree that JS is not easier these days. It only seems easier because we all already know it.
- ForHackernews 2y agoThis author already has JS Stockholm syndrome and at least acknowledges that up front.
- SebastianKra 2y agoI think you're misunderstanding the billion dollar mistake. It was not statically tracking null-references. In JS, everything is dynamic so it doesn't apply, and TS does check them. > My goal was to ensure that all use of references should be absolutely safe, with checking performed automatically by the compiler. But I couldn't resist the temptation to put in a null reference https://en.wikipedia.org/wiki/Tony_Hoare https://en.wikipedia.org/wiki/Tony_Hoare (Emphasis mine)
- agentultra 2y ago> a rewrite is often faster just because it’s a rewrite – you know more the second time around I think people often overlook this factor when doing rewrites and making big claims about the results. Chances are if you’d done the rewrite in the same language you’d get similar results. I don’t know if it’d be possible to empirically prove that. I’ve only seen it happen a few times.
- ipnon 2y agoIt’s like saying you’ll rewrite Romeo and Juliet because you already know they die at the end. It’s a little more nuanced than that!
- agentultra 2y agoYes, I agree it is nuanced. I have a particular stereotypical programmer in mind. The one that rewrites their entire program in X, because it's fast. Not because they understand the data dependencies and run-time performance characteristics of their program. Typically these folks misattribute the performance gains they experience in such projects to the language itself rather than the tacit knowledge they have of the original program.
- acureau 2y agoAt the end of the day switching from an interpreted language to a natively compiled language will result in a faster program. Of course there are performance gains to be had refactoring with a deeper understanding of the problem. That might be enough in many cases, but if the primary goal is speed the language cannot be ruled out.
- actualwitch 2y agoI was recently watching a talk about uv by one of the developers. One thing he said has really stayed with me after the talk - having tooling that works near-instantaneously unlocks whole new category of experiences. Inspired by that I gave Bun a try to see how modern front-end may look like without all the cruft, and it's just insane how much complexity you can shave off that way. For example, I would never imagine just bundling your whole project in a server handler. But it just works and if not for the lack of client auto refresh when files change (backend rebuilds just fine), I wouldn't even be able to notice the difference between that and dev server.
- bionhoward 2y agoOne part I took issue with is “elite priesthood of Rust and Zig developers” .. I love Rust and hope everyone working on interpreted / high level / “easy” languages knows Rust is accessible and doable for most developers, especially in sync land. You can benefit from 1000x (!) speed ups just rewriting sync Python in sync Rust, in my measured experience, because the compiler helps exponentially more the more abstract your code is, and Rust can absolutely do high level systems. The main blocker is when you’re missing some library because it doesn’t exist in Rust, but that’s almost always a big opportunity for open source innovation
- VeejayRampay 2y agomost of the python code that would benefit from goign faster is already written to use libraries written in C anyway, I doubt you would get x1000 out of them like that (I'd be happy to be proven wrong if you have examples though)
- cxr 2y ago> exponentially more No. The word means something. It's bad enough when it gets misused colloquially e.g. by folks on Twitter and clueless podcasters trying to spice up their talking points, but in a thread like this one, it has no place getting dropped into the discussion except if talking about something that actually fits an exponential curve.
- afavour 2y agoI have sympathy with this viewpoint... but only to a certain limit. I've optimized JS codebases before now and ended up reaching for typed arrays, arraybuffers and even workers to get things running in parallel and yeah, it's possible. But I'd much rather just be doing in Rust or a similar language. And now that WASM is a realistic possibility I can.
- Jcampuzano2 2y agoThe interesting part is that often you don't even need to parallelize when using a language like Go or Rust to see a speedup when compared to JS. You could start by writing everything super simple and straightforward, completely sync and already see a multiplier on the speed just due to the language being that much faster.
- jmull 2y agoDon't bother telling me you're rewriting something for performance if you haven't profiled the existing solution and optimized based on that.
- showsomerespect 2y agoRunning a blank .js file in node took 66 milliseconds. An optimized binary I wrote in rust takes 2 milliseconds to execute. So, I think there's a cap there on how fast JavaScript tools can be
- WorldMaker 2y agoThis is addressed in the article. Node doesn't cache an JS compilation data by default. There's an environment flag to turn that on, and the startup time drastically reduces with it on (on the second+ run of the file). Also both Deno and Bun have more optimized startup times in general by default, some of that startup time is just Node, not a reflection of the language itself.
- Alifatisk 2y agoWhich env flag are you referring to? "--experimental-vm-modules"? Or maybe "--experimental-policy"?
- WorldMaker 2y ago`export NODE_COMPILE_CACHE=~/.cache/nodejs-compile-cache`
- Alifatisk 2y agoHad no idea about this, thanks!
- klodolph 2y agoSure, but ESBuild is here, it works, and the subjective speed improvement is just fucking massive. I’m sure you could get something with similar performance in JS. I’ve messed around with JS daemons, so you don’t care about startup time for programs like tsc and whatnot. The problem is that it’s just a pain in the ass to get any of this to work, whereas ESBuild is just fast. Maybe these problems with JS will get solved at some point, because we haven’t exhausted all of the possibilities for making JS faster (like the author says). However, when you write the tools in Rust or Go or whatever, you get a fast tool without trying very hard.
- wormlord 2y ago> For another thing: it’s straightforward to modify JavaScript dependencies locally. I’ve often tweaked something in my local node_modules folder when I’m trying to track down a bug or work on a feature in a library I depend on. Whereas if it’s written in a native language, I’d need to check out the source code and compile it myself – a big barrier to entry. Anecdotally I have had to do this in js a few times. I have never had to do this in Rust. Probably because Rust projects are likely to ship with fewer bugs. Also Rust is harder to pick up but what are you going to do, use the most accessible tool to solve every problem, regardless of its' efficacy? I am not a Rust expert by any means, but just reading the Rust book and doing a couple projects made me a better programmer in my daily driver languages (js and Python). I think speed is less important here than correctness. Every time you ship a buggy library you are wasting the time of every single end user. The correctness alone probably saves more time in total than any performance gains.
- benesch 2y ago> Anecdotally I have had to do this in js a few times. I have never had to do this in Rust. Probably because Rust projects are likely to ship with fewer bugs. Still anecdotal, but I have worked on a large Rust codebase (Materialize) for six years, worked professionally in JavaScript before that, and I definitely wouldn’t say that Rust projects have fewer bugs than JavaScript projects. Rust projects have plenty of bugs. Just not memory safety bugs—but then you don’t have those in JavaScript either. And with the advent of TypeScript, many JS projects now have all the correctness benefits of using a language with a powerful type system. We’ve forked dozens of Rust libraries over the years to fix bugs and add missing features. And I’m know individual Materialize developers have had to patch log lines into our dependencies while debugging locally many a time—no record of that makes it into the commit log, though.
- wormlord 2y agoIt could be that I just haven't written enough Rust to encounter this issue. Thanks for the insight!
- munificent 2y ago> I don’t think that JavaScript is inherently slow It is. Brilliant engineers have spent decades making it faster than you might expect, subject to many caveats, and after the JIT has had plenty of time to warm up, and if you're careful to write your code in such a way that it doesn't fall off the JITs optimization paths, etc. Meanwhile, any typical statically typed language with a rudimentary ahead of time compiler will generally be faster than a JS VM will ever approach. And you don't have to wait for the JIT to warm up. There are a lot of good things about dynamically typed languages, but if you're writing a large program that must startup quickly and where performance is critical, I think the right answer is a sound typed language.
- causal 2y agoIt mostly depends on the application. If you're doing complex transforms over hundreds of GBs of data- yeah, use a workhorse for that. But the vast majority of slow JS I've encountered was slow because of an insane dependency tree or wildly inefficient call stacks. Faster languages cannot fix polynomial or above complexity issues.
- chubot 2y agoYeah but the application we're talking about here is JavaScript tools, or more generally "language processors" / AST-based workloads These are very different than your average JavaScript program And that's exactly where it starts to be the case that JavaScript semantics are the issue Take it from Lars Bak and Emery Berger (based on their actions, not just opinions): https://lobste.rs/s/ytjc8x/why_i_m_skeptical_rewriting_javascript#c_9yf3tq https://lobste.rs/s/ytjc8x/why_i_m_skeptical_rewriting_javas... :)
- munificent 2y ago> If you're doing complex transforms over hundreds of GBs of data- It's not always about giant datasets. Latency matters too for software that is run frequently by users. I maintain a code formatter. In a typical invocation, it's processing only a few hundred kilobytes of input data. But it is invoked every time a user hits control-S, thousands of times a day. If I make it a few hundred milliseconds slower, it materially impacts their flow and productivity. > Faster languages cannot fix polynomial or above complexity issues. This is true. But once you have fixed all of your algorithmic issues, if your language is slow, you're completely stuck at that point. You have hit a performance ceiling. Personally, I would rather work in a language where that ceiling is higher than it is in JavaScript.
- __mharrison__ 2y agoThis is a huge boon for Python. I would blame numpy for Python's popularity today. Writing coffee as fast as c or fortran in Python is awesome (and keeps me employed).
- Decabytes 2y agoHonestly I think the future of languages is strong and sound type inference. Writing Dart, F#, Swift, Crystal, and even modern C# has shown me to varying degrees how good a language can be at type inference, and what the tradeoffs are. I much prefer it to the gradually typed approach, but I've found that library authors in gradually typed languages usually type the entire library and as a developer I always appreciate it.
- okaleniuk 2y agoWe used to rewrite Python code in C++ "for performance". We stopped when the equivalent rewritten version appeared 3 times slower than the original. The very notion of "fast and slow languages" is nonsense. A language is just an interface for a compiler, translator, or interpreter of some sort. A language is only steer wheel and pedals, not the whole car, so the whole arguments which one is faster is stupid. In our case, AOT compilation backfired. We used (contractually had to) support older architectures and our Eigen built with meager SSE2 support couldn't possibly outrun Numpy built with AVX-512. So we stopped rewriting. And then Numba (built on the same LLVM as clang) came up. And then not one but several AOT Python compilers. And now JIT compiler is in the standard Python.
- jart 2y agoAnd Numpy can't come anywhere close to the performance of my C++ code. Last time I benchmarked my CPU matrix multiplication algorithm, it went 27x faster than Numpy. Mostly because Numpy only used a single core. But this was a machine with eight cores. So my code went at least 3x faster. Moral of the story: C++ isn't something you can just foray into whenever Python is slow. It's the most complicated language there is, and the language itself is really just the tip of the iceberg of what we mean when we talk about C++. Do not underestimate the amount of devotion it takes get results out of C++ that are better than what high level libraries like Numpy can already provide you. https://justine.lol/c.jpg https://justine.lol/c.jpg
- okaleniuk 2y agoYes but the amount of devotion is orthogonal to the language per se. You can use Numba that uses the same LLVM clang does and write all the computation kernels yourself instead of using what Numpy provides. The only difference there would be JIT vs AOT compilation. Or you can use Codon, that uses the same LLVM clang does and then there will be no difference at all. Language is just an interface for a compiler.
- jart 2y agoYeah that's what I was getting at with the tip of the iceberg thing. You can of course choose a different tip for your iceberg.
- zcmack 2y agoi share some of this sentiment as well and i think a lot of my hesitance is that these solutions seem born of the popularity of rust. we have had c and c++ for as long as javascript has been a full-stack workhorse. is it just the barrier of entry / novelty of rust has prompted longtime js devs to make the leap into building tooling? along with it, it seems the "new framework every week" jab at javascript can be applied to the build system as well. in any case, i welcome the speed improvements and this certainly does not preclude me from using these new tools where i'm able.
- Brain_Man 2y agoYes. The somewhat nice property of rust having guaranteed memory safety has been blown out of proportion so much that even though C++ with smart pointers and a bit of bounds checking is quite likely not to have memory safety issues, the comunity has decided that anything less than a guarantee means the language is unfit for any purpose and no new projects should ever be started in it. As if Java/JS/C# don't have null reference exceptions occurring all the time and to me those seem quite similar to segfaults. But I guess people are only specifically alergic to memory unsafety.
- cincinnatus 2y agoAs I have (admittedly snarkily) put it many times "every line of JS is tech debt"
- thiht 2y agoHonestly if you’ve used esbuild (you have if you use Vite) once, you cannot legitimately be skeptical of rewriting JS tools in faster languages. The difference is so huge it’s not even funny.
- xpl 2y agoThis is often overlooked but is actually a big deal: > ...it’s straightforward to modify JavaScript dependencies locally. I’ve often tweaked something in my local node_modules folder when I’m trying to track down a bug or work on a feature in a library I depend on. Whereas if it’s written in a native language, I’d need to check out the source code and compile it myself – a big barrier to entry. I too often find myself inserting `console.log` inside node_modules to figure out why the toolchain doesn't work as I'm expecting it to. It has gotten me out of some very nasty situations when StackOverflow/Google/GPT didn't help at all. Had it been written in Rust, I wouldn't have had a chance.
- eacapeisfutuile 2y agoYou can erase JavaScript from this title and have equally valid points.
- xiaodai 2y agoThis post doesn’t make any sense. If a rewrite in another lang being faster is just due to rewrite then surely someone would attempt rewrite in JavaScript and come out just as fast. So far there hasn’t been any case of such happening
- jviotti 2y agoTo the article's point, many/most JavaScript projects are not optimised and better performance can be achieved with just JavaScript, and yes, JavaScript engines are becoming faster. However, no matter how much faster JavaScript can get, you can still always get faster with other system languages. I work on high-performance stuff as a C++ engineer, currently working on an ultra fast JSON Schema validator. We are benchmarking against AJV (https://ajv.js.org https://ajv.js.org), a project with a TON of VERY crazy optimisations to squeeze out as much performance as possible (REALLY well optimised compared to other JavaScript libraries), and we still get numbers like 200x faster than it with C++.