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

If we allow native libraries, it's not clear that C++ would win, even on modern hardware.


I think we all know that, when someone writes "C++ is three orders of a magnitude faster than Python" they're not including native libraries.


You can't not include native libraries, at least if you want your benchmark to be realistic. Almost every Python library where performance matters is written (at least partially) in a compiled language.


Yes, but many people like the sound of "X-times faster than Python" while conveniently forgetting that the same thing can be (and usually is) done in Python + numpy & co. even faster.

I have come to appreciate "slowness" of Python. It trades speed for legibility, which is a great compromise once you have really fast native libraries one import away. Best of both worlds.


C++ with well-optimized libraries should always outperform Python with well-optimized libraries, right? They should be ~identical in the highly optimized inner loops, but Python has more overhead. But naive hand-written C++ could easily perform worse than something like Numpy.

(I've only tested this once, and my naive hand-written C++ was still twice as fast as Numpy, but that was only on one specific task.)




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

Search: