logoalt Hacker News

FartyMcFarter • today at 9:29 AM • 3 replies • view on HN

Yes. Python is usually 10-100x slower than languages like C, C++ or Rust. If your program is CPU bound, this shows up very obviously. If it isn't, you may never notice at all.

Imagine being able to use only 1% of the machines you used to require, by migrating away from Python. This is very realistic for companies doing heavy computational work.


Replies

rhdunn • today at 11:16 AM

Libraries generally write hot code in languages like C, C++, or Rust and bind that to Python (PyTorch, etc.) or provide bindings/wrappers around libraries in those languages (SQLite, PostgreSQL, etc.).

As with anything performance related you need to profile the code with realistic data/workflows and identify the parts that are slow.

Typically, doing things like changing algorithms, data structures, careful use of caching, reusing calculations, etc. are more important to performance than the choice of language.

cadamsdotcom • today at 10:21 AM

What you're saying is valid too; but, the post you're replying to implied most slowness is network (i/o bound) or bad architecture (accidental cpu bound, fixable by tech debt cleanup).

➕ show 1 reply