6 ms·
So finally the greening of programming languages! Kind of hard to argue with the article's premise. Though all languages aren't equal for all tasks. For exampl
by allisdust 5y ago
So finally the greening of programming languages!
Kind of hard to argue with the article's premise. Though all languages aren't equal for all tasks. For example, its hard to use Rust for web projects because the ecosystem isn't mature enough. May be there should be investments into Rust ecosystem from pro-environment groups.
PS: that Go memory usage is incredible. Why is it so low when compared with even 'C'.
- scottlamb 5y ago> May be there should be investments into Rust ecosystem from pro-environment groups. Meh, I think they have better ways to spend their limited resources than putting them into something Amazon is also investing in. > PS: that Go memory usage is incredible. Why is it so low when compared with even 'C'. That study has been posted here and a bunch of other places and just isn't that reliable. It's based on The Computer Language Benchmarks Game. Some of the implementations are painstakingly optimized with SIMD and sophisticated algorithms. Some aren’t. It’s benchmarking N different programs written in M languages (where M<N) that satisfy a given challenge, not the same program ported to N languages. Which languages have high-quality implementations might say more about how obsessed a given language’s community is with this particular set of benchmarks and rules than the actual efficiency of the language in question. Take a look at the dramatic difference between Javascript and Typescript. Then realize that Typescript is literally the same language. Basically I think someone wrote slow-solution.ts, then someone else wrote fast-solution.js, and no one bothered to cp fast-solution.js fast-solution.ts. Edit: that said, I do think Rust is genuinely a great language when you need security and efficiency together. And Go is a great language when efficiency is not quite as important as productivity.
- bick_nyers 5y agoI've still not yet seen a proper benchmark of performance across programming languages that properly accounts for the spectrum of implementation ability that a particular engineer might have. If Leetcode published some of its statistics though it might be pretty good
- igouy 5y ago> I've still not yet seen… Why do you think that is? Perhaps it's because "proper" is ill-defined and very much a matter of individual opinion.
- zozbot234 5y ago> And Go is a great language when efficiency is not quite as important as productivity. The Go problem is not so much that it's inefficient, it's that the lack of compile-time checks encourages bug-prone cowboy coding which is often mistaken as "higher productivity". Because no one's measuring the very real productivity impact of easily preventable software defects.
- AshamedCaptain 5y ago> . It’s benchmarking N different programs written in M languages (where M<N) that satisfy a given challenge, not the same program ported to N languages. And using K different standard libraries. Otherwise I can't explain that they put C on a different result as C++, considering they are often the same compiler (and not just the same backend). Probably, it is benchmarking stdio vs iostreams or the like, which is interesting.
- igouy 5y ago> Otherwise I can't explain… They provided the source code of their programs and makefiles. There's no need for guessing games — https://github.com/greensoftwarelab/Energy-Languages https://github.com/greensoftwarelab/Energy-Languages
- scottlamb 5y agoYes, iirc the Game's maintainer has some rules about idiomatic code. They might mean that if a language has a hash map built into its std library, you can't supply your own. C++'s std::unordered_map is infamously bad (as compared to e.g. absl::flat_hash_map) so that hurts. C has almost no useful library or idioms. In normal circumstances, I consider that a disadvantage, but in this case it may mean you write your own more optimal code and achieve a better score...
- igouy 5y ago> might mean None of the current 3 C++ programs use `std::unordered_map` they use `assoc_container.hpp`. The current C program uses `khash.h`. Someone who was interested in evaluating "Energy Efficiency across Programming Languages" would have to look at the authors public code archive and understand what they did.
- igouy 5y ago> It's based on The Computer Language Benchmarks Game… It's based on these 4 year old programs — https://github.com/greensoftwarelab/Energy-Languages https://github.com/greensoftwarelab/Energy-Languages > … the same program ported to N languages… You can write Fortran in any language ? ---- > … no one bothered to cp fast-solution.js fast-solution.ts. Perhaps figuring out correct type annotations was too much of a barrier.
- scottlamb 5y ago> > It's based on The Computer Language Benchmarks Game… > It's based on these 4 year old programs —https://github.com/greensoftwarelab/Energy-Languages https://github.com/greensoftwarelab/Energy-Languages Yes, that repo's blurb confirms what I said: "The complete set of tools for energy consumption analysis of programming languages, using Computer Language Benchmark Game" If you were making some other point, I missed it. As for the programs being four years old, the paper was published in 2017, so that's exactly as expected... > > … no one bothered to cp fast-solution.js fast-solution.ts. > Perhaps figuring out correct type annotations was too much of a barrier. Sure, the details don't interest me. The point is that these two languages with identical compilers (TypeScript gets translated to JavaScript, discarding you're annotations) show wildly different scores, which makes it impossible to take any of these numbers too seriously.
- igouy 5y ago> … I missed it. Your "painstakingly optimized with SIMD" doesn't apply much to those 4 year old programs. > … which makes it impossible to take any of these numbers too seriously. Never throw the baby out with the bath water. Never take any numbers too seriously, just seriously enough.
- scottlamb 5y ago> Your "painstakingly optimized with SIMD" doesn't apply much to those 4 year old programs. What's this then? https://github.com/greensoftwarelab/Energy-Languages/blob/master/C/n-body/nbody.gcc-4.c#L100 https://github.com/greensoftwarelab/Energy-Languages/blob/ma... There are some explicit SIMD instructions, and some programs written to allow autovectorization. > Never throw the baby out with the bath water. /eyeroll There's no baby. There's no significant investment in applying equal levels of optimizations to the programs across languages. TypeScript vs JavaScript is a telling example but hardly the only one.
- azth 5y ago> And Go is a great language when efficiency is not quite as important as productivity. Which still significantly lags Java and C# when it comes to productivity.
- zozbot234 5y ago> For example, its hard to use Rust for web projects because the ecosystem isn't mature enough. Actix-web is finally getting a stable, production-usable release. That alone ought to amount to a pretty sizeable boost for the ecosystem.
- mwcampbell 5y agoWhat do you mean? actix-web hit 1.0 a long time ago. If that 1.0 wasn't actually stable and usable in production, or if there's another upcoming milestone, can you please provide a link?
- zozbot234 5y agoIt was unmaintained for quite some time, but it's been picked up again and is pushing out new releases.
- deleted 5y ago[deleted]
- collegeburner 5y agoRust has a mature web ecosystem with actix web. It is almost at a 4.0 release.
- newlisp 5y agoSure, the base is there but for example, there's nothing like Java's itext. That is what devs refers to by immature ecosystem.
- sorenjan 5y agoWhen I looked into Rust for web development I looked at Rocket and Actix web. Rocket seems to be on some kind of hiatus and haven't had any development in months, so that seems like a risky bet. Actix web had some drama two years ago when the founder and lead developer moved the repository and quit. He later appointed a new lead and it seems to do well since then, but it does give cause for concern. Can you build on top of frameworks that so easily can get stale or taken down? Are all of them maintained by single unpaid open source developers? I think Rust looks like a great fit for efficient back end programs, so I want it to succeed.
- collegeburner 5y agoActix had drama and has been community managed for a long time since that. Last time I looked rocket was working toward stability but not there. It's more of a batteries included solution anyway so maybe better for small projects than production stuff, actix has some good flexibility for those.
- sorenjan 5y agoOk, so Actix could be considered a good option for a new project? I liked Rocket's syntax, especially the Requests guards [0] I thought seemed like a good idea, but I haven't really looked that close to either since I never started my project. [0] https://rocket.rs/v0.5-rc/guide/requests/#request-guards https://rocket.rs/v0.5-rc/guide/requests/#request-guards