
Ask HN: Which language for writing a fast, distributable command-line tool? - bakery2k
I need to build a command-line tool to perform some fairly heavy computation. I would like end-users to be able to easily run the tool on their own systems.<p>I have written a proof-of-concept in Python, but it is unacceptably slow: 100 times slower than an implementation of the core algorithm in C++. Also, it would be awkward to distribute to end-users: the best option seems to be a tool such as PyInstaller which essentially creates a large, self-extracting archive. Running the Python code using PyPy fixes the performance issue (only 4x slower than C++), but makes distribution almost impossible.<p>So, I am looking for another language in which to write the production version of this tool. Which other language(s) would you recommend?<p>I would rather avoid writing the whole tool in a complex language like C++. Are there any other Python-like, dynamic languages which are faster and easier to distribute?
======
binki89
I've previously used Go to develop a command-line tool and it worked quite
well. I particularly liked the fact that I could cross-compile it so that I
had a single static binary that could target various platforms/OSes without
the need to compile explicitly on those platforms. I also think that Nim and
Crystal could be quite good for this. Crystal, in particular has a remarkable
scripting language feel, because of the extensive type inference, despite
being natively compiled. It's also faster than Go, which is itself quite fast.
Nim is no slouch performance wise either though and has the most pythonic like
syntax of the languages I've described here.

------
cbanek
I don't doubt that python is slower than a compiled language, but have you
tried to do any profiling on your python code? Sometimes little changes could
have a huge impact.

[http://stackoverflow.com/questions/582336/how-can-you-
profil...](http://stackoverflow.com/questions/582336/how-can-you-profile-a-
python-script)

I used the command line option described in the suggested answer. It was easy.
Most profilers are hard, but this worked fine the first time.

------
brbsix
I've been in this same boat a few times (e.g. looking to replace a slow Python
tool that has big dependencies like PyQt5). The quick and easy solution (even
for someone with very little JS experience) was to rewrite the application in
Node.js and bundle it up as a single executable with nexe [0].

[0]:
[https://github.com/jaredallard/nexe](https://github.com/jaredallard/nexe)

------
hilti
I'm using newLISP for command-line tools and scripting. I love that it's
capable of doing bayes calculation, parallel and distributed processing
support is built-in and it runs on embedded systems too.

------
morpheyesh
Go is definitely a good option. Also try Rust, its a system programming
language that is the closest to C. It will be super fast if you don't abuse
the functional constructs that the language provides :)

~~~
lfx
Is it possible to distribute Rust `app` as easy as Go? I mean can you write
one code and run on all platforms with zero dependencies?

P.S. I'm not proGo, just have near to zero knowledge about Rust.

------
ex_amazon_se
You are looking for Nim: Python-like syntax, faster than Go, statically
compiled.

------
tumdum_
Although not a dynamic language, I think Go meets all of your needs.

It is statically compiled - you get one executable without any dependencies.

Its speed is much closer to C than to Python.

Type system and syntax is very simple.

------
imauld
I also would suggest Go. Coming form Python writing Go came pretty naturally
so you should have no problem taking your POC code and rewriting it in Go.

------
dsparkman
I would say Go. Stick with the standard library and you compiling for all the
supported platforms is pretty straight-forward.

------
vram22
Go, D, maybe Nim may be worth checking out for this.

------
jacquesm
Any compiled language that you already know how to use.

