this post was submitted on 12 Apr 2025
196 points (90.2% liked)

Technology

69098 readers
3036 users here now

This is a most excellent place for technology news and articles.


Our Rules


  1. Follow the lemmy.world rules.
  2. Only tech related news or articles.
  3. Be excellent to each other!
  4. Mod approved content bots can post up to 10 articles per day.
  5. Threads asking for personal tech support may be deleted.
  6. Politics threads may be removed.
  7. No memes allowed as posts, OK to post as comments.
  8. Only approved bots from the list below, this includes using AI responses and summaries. To ask if your bot can be added please contact a mod.
  9. Check for duplicates before posting, duplicates may be removed
  10. Accounts 7 days and younger will have their posts automatically removed.

Approved Bots


founded 2 years ago
MODERATORS
you are viewing a single comment's thread
view the rest of the comments
[โ€“] Randelung@lemmy.world 4 points 1 week ago (1 children)

It comes down to the question "Is YOUR C++ code faster than Python?" (and of course the reverse).

I've built a SCADA from scratch and performance requirements are low to begin with, seeing as it's all network bound and real world objects take time to react, but I'm finding everything is very timely.

A colleague used SQLAlchemy for a similar task and got abysmal performance. No wonder, it's constantly querying the DB for single results.

Exactly!

We rewrote some Fortran code (known for fast perf) into Python and the net result was faster. Why? They used bubble sort in a hot loop, whereas we used Python's built-in sort (probably qsort or similar). So despite Python being "slower" on average, good architecture matters a lot more.

And your Python code doesn't have to be 100% Python, you can write performance-critical code in something else, like C++ or Rust. This is very common, and it's why popular Python libraries like numpy and scipy are written in a more performant language with a Python wrapper.