4 ms·
Perl and Python are scripting languages, their energy savings come from the fact that the programmer is typically the only person who will be running it, so it
by smoldesu 5y ago
Perl and Python are scripting languages, their energy savings come from the fact that the programmer is typically the only person who will be running it, so it makes more sense to write something that minimizes screen-on time than it does to micro-optimize an app that hundreds of thousands of people will interact with. It's entirely a matter of scale: if you're working server-side, I'd wager you're saving quite a bit of energy by not using an IDE that constantly relies on static analysis to make sure you're not shooting yourself in the foot.
- dmz73 5y agoYou are right about Perlubie and Python being scripting languages but unfortunately people use them for full applications that use 10 to 100 times the memory and CPU of what is necessary. Now C and C++ are the other side of this coin where they could be 10 to 100 times more efficient than scripting languages but it is often difficult to get that right without a lot of work. But there are a number of languages in between where doing the correct thing is easy and CPU and memory efficiency is close to or on par with best C and C++. So we can have nice things after all!
- tablespoon 5y ago> You are right about [Perl] and Python being scripting languages but unfortunately people use them for full applications that use 10 to 100 times the memory and CPU of what is necessary. And honestly, that would be an improvement. The trend seems to be to write more and more applications in JavaScript with Electron [1], which I unrigorously assume uses 10 to 100 times the memory and CPU of an equivalent Python app (given Electron apps seem to most frequently make my fan spin or have some kind of memory leak requiring a force-kill). [1] Now ranking higher on Google than the subatomic particle: https://www.google.com/search?q=electron https://www.google.com/search?q=electron (https://archive.ph/J2HYI https://archive.ph/J2HYI)
- dralley 5y agoJavascript is faster than Python by a not-insubstantial amount, due to JIT and the sheer number of man hours poured into optimizing the browser Javascript engines. I have no idea about memory consumption. I assume Python does better than Javascript there due to reference counting.
- etaioinshrdlu 5y agoWell, JS on v8 (node.js) is usually more CPU efficient than a Python app due to its good JIT compiler. Perhaps the memory usage is not as great due to requiring a GC. I suspect that Electron apps are so easy to create and run somewhat acceptably, that the trend is for the developer to add more bloat than would otherwise be there. So a very efficient runtime leads to developer laziness.
- weare138 5y agoBut you have to take these results with a grain of salt. Both the Perl and Python tests are implementing binary trees in vanilla Perl and Python. Both Perl and Python have performant libraries written in C which is what you would use in a situation like this.
- jhgb 5y ago> Both the Perl and Python tests are implementing binary trees in vanilla Perl and Python. Well, that's how you judge a language. You write code in it, as opposed to writing it in some different language not under consideration. But a much worse problem seems to be the fact that binary-trees is not much of a representative benchmark. It's mostly a benchmark of your memory management. Unless your programs spend 80% of their time managing memory, they'll probably not match the results of binary-trees.
- emilper 5y agothat is _not_ how you judge a _scripting_ language it is trivial* to add C code to Perl, even when using XS, I guess it is as easy to do the same for Python if you do heavy computations in pure Perl5 or pure Python you're doing it wrong by definition *assuming you can write C
- justinator 5y ago> Perlubie Found the Australian.
- Kranar 5y agoThat is true of Perl, but Python powers web apps viewed by billions of users, including reddit and instagram.
- FpUser 5y agoAnd we also burn coal and other lovely stuff for energy.
- throwaway984393 5y agoPython is just as shitty as Perl, it just has different syntax.
- rodmena 5y agoPython is not only a scripting language. It powers many many websites including Youtube. It's a full power limitless language. Your statement is simply wrong.
- Supermancho 5y ago> Python is not only a scripting language. The Python (programming language) is. Ok, if you want to get pedantic you can talk about the language vs interpreter vs ecosystem? I'm not sure what you are getting at. > It powers many many websites including Youtube. It's a full power limitless language. Lots of things "power" Youtube. I'm not sure how that's important to point out.
- throwaway984393 5y ago> It's a full power limitless language Unless you want to do something crazy like run 2 threads at the same time
- grumpyprole 5y agoPython is not limitless. It has very much reached its limit and has major problems with performance, concurrency/parallelism, static analysis and formal semantics. This is why many refer to it as a "scripting language". This doesn't necessary stop people building billion dollar businesses with it though, look at PHP.
- UncleMeat 5y ago> It powers many many websites including Youtube. And this was such a scalability problem that Youtube decided to spend the unimaginable amount of pain and suffering to rewrite in C++.
- rodmena 5y agoI partially agree with your statement. Writing anything in C++ would cause _unimaginable_ amount of pain and suffering. Better way is to isolate slow CPU heavy stuff and write it in C without suffering.
- dragonwriter 5y ago> Perl and Python are scripting languages, With the exception of shell languages (and its overstated even there), the description “scripting language” is usually wrong and at extremely deceptively reductive, even for languages where that was a motivating or at least early major use case. > their energy savings come from the fact that the programmer is typically the only person who will be running it, Even when languages are used for scripting, that's not true.