Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

I felt this pretty viscerally recently. I did Advent of Code 2021 in python last year. My day job is programming in Python so I didn't really think about the execution speed of my solutions much.

As a fun exercise this year I've been doing Advent of Code 2020 in C, and my god it's crazy how much faster my solutions seem to execute. These are just little toy problems, but even still the speed difference is night and day.

Although, I still find Python much easier to read and maintain, but that may just be I'm more experienced with the language.



> Although, I still find Python much easier to read and maintain, but that may just be I'm more experienced with the language.

Python is definitely easier to read and maintain if you have loads of dependencies. C dependency management is a pain.

If you can read and write a little C, you should consider giving C#/Java/Kotlin/Swift a try. They're probably an order of magnitude slower than C if you write them in a maintainable style, but they're still much faster than Python. If you're doing stuff like web APIs then ASP.NET/Spring will perform very admirably without manually optimizing code, for example. You might find that these languages are C-like enough to understand and Python-like enough to be productive in. Or you might not, but it's worth a shot!

I personally believe that C is difficult if not impossible to properly to maintain long term, at least not as much as the faster alternatives. On the other hand my experience with Python is that it's one of the slowest mainstream languages out there, relying heavily on C libraries to get acceptable performance.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: