• bitcrafter
    link
    fedilink
    arrow-up
    6
    ·
    6 months ago

    Unless the C++ code was doing something wrong there’s literally no way you can write pure Python that’s 10x faster than it. Something else is going on there.

    Completely agreed, but it can be surprising just how often C++ really is written that inefficiently; I have had multiple successes in my career of rewriting C++ code in Python and making it faster in the process, but never because Python is inherently faster than C++.

    • FizzyOrange
      link
      fedilink
      arrow-up
      1
      ·
      5 months ago

      Yeah exactly. You made it faster through algorithmic improvement. Like for like Python is far far slower than C++ and it’s impossible to write Python that is as fast as C++.