Context: Writing an open source CLI tool.

Go and Rust over Python: Simple distribution.

With Go and Rust, just build statically compiled binaries and hand them out.

With Python, have people install with "pip install --user" and not finding the binaries :(.

Go and Rust over Python: Startup and runtime performance

Go and Rust over Python: No need to worry about which Python interpreter version is installed on the users' machines.

Go over Rust: Simplicity; Rust's memory management comes at a development / maintenance cost.

Go over Rust: Easier cross compiles from macOS to Linux.

READ LESS
12 upvotes·6 comments·385.2K views
Ionut Oprea
Ionut Oprea
·
February 6th 2021 at 2:20PM

With Python, you could always have used a package like py2exe to create an executable that you can distribute.

·
Reply
Johan Walles
Johan Walles
·
February 6th 2021 at 6:41PM

Py2exe is Windows only according to their home page.

And even if it wasn't, it doesn't solve the Python-is-slow problem.

This can be an issue if you're [creating diffs](https://github.com/walles/riff) or [searching text while people wait](https://github.com/walles/moar).

·
Reply
Ionut Oprea
Ionut Oprea
·
February 7th 2021 at 4:20PM

Yes, for real-time-stuff you either need C-level logic or other optimizations;

However, if you just want a multiplatform version of py2exe, there'a another Python module, PyInstaller, which works on pretty much all the major platforms, including Windows, GNU/Linux, Mac OS X, FreeBSD, Solaris and AIX.

·
Reply
Johan Walles
Johan Walles
·
February 9th 2021 at 7:55AM

To be picky, it's not C-level *logic* that's needed, it's C-level *performance*.

Which is offered by much nicer languages than C, like Rust and Go.

PyInstaller can't cross compile, which is annoying in my open-source-CLI case:

https://realpython.com/pyinstaller-python/#limitations

·
Reply
Kudos Beluga
Kudos Beluga
·
February 6th 2021 at 7:15PM

There was a response in this article (which I find pretty biased personally) https://medium.com/better-programming/modern-languages-suck-ad21cbc8a57c, in which there was a response by Taylor Allred that gives a valid counterargument over why you chose go over rust because of simplicity:

I would ask that you give more credit to Rust's memory management system, though. It's ownership-borrowing mechanism takes some time to learn but it's rooted in good principles and allows for very safe and performant code without a GC or need for manual management. This system also makes concurrency very safe and straightforward for a low-level language. Also, all values are immutable by default and it wouldn't be hard to implement an immutable data-structure. Despite it being a low-level language, it gives you the tools of abstraction like traits and macros to write fairly simple high-level code.

In addition to that, the Rust compiler is absolutely fantastic! It catches 90% of the bugs I make! It's also next to c++ in performance. It is also the most liked language 5 years in a row from the Stack Overflow Developer Survey: https://insights.stackoverflow.com/survey/2020#technology-most-loved-dreaded-and-wanted-languages-loved

·
Reply
Johan Walles
Johan Walles
·
September 16th 2023 at 12:43PM

I might have changed my mind over time, but the reasoning behind "development / maintenance cost" used to be:

* Go is easier to learn than Rust. This is still a fact, and that article doesn't change that.

* Therefore I reasoned it would be easier for some random person to contribute to Go code than to Rust code

* Also, I used to believe there were more Go developers than Rust developers, but now I'm not so sure any more: https://insights.stackoverflow.com/trends?tags=rust%2Cgo

Today I think (very subjectively) Rust is more fun than Go, and I have recently picked Rust over Go for another project.

And the fact is that no matter the language, very few people actually provide patches, so my reasoning around that might not have been relevant.

So between Go and Rust my new recommendation is to pick whichever you like best and never mind which would be easiest to get contributors for.

Happy hacking :)

·
Reply
Avatar of Johan Walles