Hacker News new | ask | show | jobs
by shaki-dora 2367 days ago
FWIW, my experience with quite a few (usually small(ish)) tasks I implemented in Crystal is in line with the article's.

Once, a CSV-parsing and string-wrangling data batch job in python indicated it would take 27 hours to finish. I got annoyed and wrote a line-by-line translation in crystal. Writing it took about 40 minutes. It took a total of 2.5 minutes to run, that's two, almost three orders of magnitude.

As I said, this was a line-by-line translation, so whatever mistakes the python version had, the crystal version would have also had them. There are, however, a bunch of specialised python libraries (numpy et al) that weren't used, and I guess you could achieve some significant performance increases that way. Coming from ruby, I just happen to be quite productive in Crystal, to the point where I stumbled over the article's description as a "systems language".

2 comments

I'm not sure why you're comparing Crystal to Python here, but just in case you've misunderstood something, Nim is a completely different language from Python. It borrows some bits of syntax (like I suppose Crystal does with Ruby, but I haven't used either of them), but otherwise it has nothing to do with Python, so a performance comparison of Crystal vs. Python doesn't say anything about Crystal vs. Nim.
There are probably ways to speed it up significantly in plain Python. For example, if you're processing strings you'll probably want to avoid iterating over individual characters and rely more on regular expressions, str.translate or other higher-level mechanisms.

Did you profile the Python code?