3 ms·
You 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 an
by dmz73 5y ago
You 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.