5 ms·
Or you can just use a more memory efficient language like Java. Python and JS use tons of memory compared to strongly typed VM languages like C#, Go, Java. Peop
by nullwasamistake 7y ago
Or you can just use a more memory efficient language like Java. Python and JS use tons of memory compared to strongly typed VM languages like C#, Go, Java. People lament Java memory usage but Python/Node use several times more
- whatshisface 7y ago>People lament Java memory usage but Python/Node use several times more The people who lament Java's memory usage never complain about Python or Ruby because... if you're worried about the JVM you would never consider Python!
- nullwasamistake 7y agoI'm mostly referring to those that say the JVM is too "resource heavy" then go on to use JS/Python/Ruby instead, which have much higher runtime overhead. In my experience many dev think the scripting language heritage means these languages have smaller/lighter runtimes
- drej 7y agoNot that I want to go down the rabbit hole, but I probably fall into the category of “JVM is heavy, but I use Python” Sure, memory consumption and CPU perf are both pretty bad in Python, but latency and memory footprint of the runtime itself are pretty good, so it’s ideal for tooling, crons, lambdas etc. JVM is comparatively efficient once you have the JVM ready, but that sure takes tons of resources. I’m hoping Graal changes this. I don’t like JVM-based languages, but I do like technological progress.
- alexhutcheson 7y agoPython startup time can be significant for non-trivial programs as well, and it's been a big problem for Mercurial and other projects. For example, see these threads: - https://mail.python.org/pipermail/python-dev/2014-May/134528.html https://mail.python.org/pipermail/python-dev/2014-May/134528... - https://mail.python.org/pipermail/python-dev/2018-May/153296.html https://mail.python.org/pipermail/python-dev/2018-May/153296... If your script is expected to be run interactively on a frequent basis, then Go, Rust, C++, or even Bash (for simple stuff) will give you much lower user-perceived latency than Python.
- nullwasamistake 7y agoIt's fairly easy to use Class Data Storage and include an archive in Java 12 where startup time is important. This reduces start time significantly. JVM starts really quick (~100ms on my machine) and doesn't use much resources as long as your app is small. that's... Uncommon in Java land though. Even simply apps pull in Guava/Apache Commons and a few client libraries. This can easily be thousands of classes. Nobody thinks about it because runtime cost for loading shitloads of code is so low. But you can improve this a ton by using ProGaurd and stripping out stuff you don't need
- mr_crankypants 7y agoIt really depends. If I can do it in numpy, I can probably get a lighter, faster implementation with Python than in Java. More generally, if I can do it with a Python package that's actually a fairly thin wrapper around a C, C++ or Fortran library, then Python also has a decent chance of being the easy winner. If none of those situations apply, then yeah, typically Java ends up being more efficient.
- fnord123 7y agoI have seen completely the opposite in the wild. In fact I've only seen it so far in the opposite direction (Java consuming far more memory than Python) that I have to ask what on Earth you are doing with Python to have found yourself in such a position. (I've never successfully used Node so I have no idea what that's like in memory use.)