8 ms·
To me, it sets expectations for - single binary deploy(unlike Python) - fast (llvm) - memory efficient (no GC) - newer (by virtue of the newness of the lang
by reacharavindh 7y ago
To me, it sets expectations for
- single binary deploy(unlike Python)
- fast (llvm)
- memory efficient (no GC)
- newer (by virtue of the newness of the language itself).
Nothing wrong with setting expectations in title ;-)
- gigatexal 7y agoGCs have come a long way. I think the bit about being memory efficient for not using a GC is FUD.
- heavenlyblue 7y ago>> GCs have come a long way Aha. I have a web server written in rust that literally uses about 5Mb memory on RPi. And that one actually has a proper web framework, not something barebones. Good luck doing that in Python.
- gigatexal 7y agoI was thinking about Go not Python when writing the above.
- dnpp123 7y agoWhich crate/framework do you use ? I'm looking at REST API frameworks for rust these days, but nothing looks decent...
- heavenlyblue 7y agoI went with Rocket. Basically I wanted to control the switching of devices on my sound amplifier using USB infrared remote. So I built the UI using yew and the web server using Rocket - but I wanted to do it fast and only in Rust.
- kbutler 7y agoBut I bet it took a lot more code than: python3 -m http.server Note also that Python is primarily reference counted, with GC used only to detect cyclic references.
- heavenlyblue 7y agoI am not serving static content, so this reply is absolutely irrelevant. On top of this, you can do the same with docker run nginx -v.:/var/www (which btw is a similar number of symbols). Also python’s http module barely supports anything but the most basic content-types (so good luck with eg SVGs).
- kbutler 7y agoAt a few more orders of magnitude of memory use, sure. Tradeoffs everywhere, which make sense or not depending on your requirements. But Python's ref counting isn't a significant factor in its memory use.
- heavenlyblue 7y ago>> At a few more orders of magnitude of memory use, sure. Are you implying nginx uses more memory than a python interpreter? :)
- chrisseaton 7y agoReference counting is a form of garbage collection.
- kbutler 7y agoSure, if you want to be pedantic, but the context was limited memory use, and ref counting does not increase the memory used for unreferenced objects (except in cycles) unlike most other garbage collection algorithms.
- johnsoft 7y agoEven just loading the base Python interpreter uses more memory than heavenlyblue's entire server. USER PID %CPU %MEM VSZ RSS TTY STAT START TIME COMMAND root 23612 1.2 1.7 62412 17492 pts/1 S+ 12:38 0:00 | \_ python3 -m http.server
- vips7L 7y agoI suppose it depends on how low you need to go, I have a service written in Java EE that is using 13Mb of memory.
- heavenlyblue 7y agoI lied. My server actually uses 2.704mb memory. On top of that, that server doesn't actually use any sorts of downgraded language version that Java EE is. You literally get that for free with Rust. I still don't understand why people argue against this. Rust is a better language in so many aspects (tooling, language capabilities) it's really hard to argue against it.
- tjoff 7y agoIn practice it is quite common. No GC forces the programmer to think about memory, this is a good thing because you need to to that in all garbabe collected languages anyway - or you will get bloat. For most use cases I consider garbage collection to be a mistake. Scripting languages or small one-off applications exempted.
- andrepd 7y agoGCs have a nonzero overhead wrt manual management. This is an undeniable fact. The only time they can compare is for memory allocation profiles that already "emulate" a sort of a tracing/refcounted GC themselves.
- pjmlp 7y agoMany GC enabled languages offer other ways to manage resources as well.
- Hamuko 7y agoYou can have single binary deployment with Python.
- ubercow13 7y agoMost people don't, though. They provide some install instructions using pip in their README, and IME these barely ever work without modification.
- reacharavindh 7y agoYes, but every time I tried it, it always fails me with some obscure error that I run away from it with bitter memory(why did I do this in Python!?!). If it is not a priority for the language, I’ll rather choose a language which cares about it.
- the_mitsuhiko 7y agoHow? Are there reusable tools for this now?
- Hamuko 7y agoI've used PyInstaller at least. Pretty sure there are others as well.
- the_mitsuhiko 7y agoI found the success rate of this very low and it’s very hard to automate this for all platforms.
- GordonS 7y agoI've never really used Python, but as a consumer of tools, I don't recall ever coming across a Python tool packaged as a binary - so it might be possible, but dose anyone actually do it?
- Hamuko 7y agoyoutube-dl does at least.