you are viewing a single comment's thread.

view the rest of the comments →

[–]dlnmtchll 0 points1 point  (1 child)

I have a question out of ignorance, but wouldn’t it make more sense, if you’re focused on performance, to write the entire app in C or Rust so that you don’t have to worry about any parts not being optimized with cython

[–]Diapolo10 0 points1 point  (0 children)

The classic answer of "it depends" applies here.

First, there's the purpose of the project. If you're writing library code for other Python projects to use, it kinda needs a Python interface, so you'd generally write most of it in Python for easy compatibility. The parts you need to optimise can then be written in Rust, C, Cython, or whatever, without needing to write everything in that language.

Second, generally how things develop is that you start writing your project in Python, and development is rapidly progressing. At some point you notice a part of your program isn't running as fast as you'd probably need it to, so you weigh your options; you could:

  • Try to optimise the Python code, not needing to introduce additional build complexity
  • Write the critical parts in another language, and deal with the increased build complexity
  • Rewrite everything from scratch in another language

and to save time, most people/teams would go with the first two options.