• Ephera@lemmy.ml
    link
    fedilink
    arrow-up
    21
    arrow-down
    1
    ·
    6 months ago

    The aim is to offer the speed of C or C++ while retaining the user-friendly feel of Python itself.

    These kind of claims always annoy me. Like, sure, there’s some room for interpretation there, but at the end of the day, C, C++ and also Rust achieve their speed by having handling baked into the semantics for:

    • non-GC memory management
    • passing by-reference vs. by-value
    • and in the case of Rust, also for handling multi-threaded processing.

    Unless he comes up with a revolutionary new memory management strategy, or achieves a massive jump in static analysis to replace human intelligence, then you simply can’t achieve similar speed while keeping the semantics of Python.

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

      That’s not really true. C# and Java are reference-based, uses GC and can be multithreaded, and are very comparable to Rust/C++/C performance. Certainly no more than twice as bad. Whereas Python is probably 50x as bad.

      The real answer is that Python developers have deliberately avoided worrying about performance when designing the language, until maybe 2 years ago. That means it has ended up being extremely dynamic and difficult to optimise, and the CPython implementation itself has also not focused on performance so it isn’t fast.

      But I agree the aim of offering C/C++ speed is never going to be met with Python syntax.

      • sugar_in_your_tea@sh.itjust.works
        link
        fedilink
        arrow-up
        2
        ·
        5 months ago

        They can probably beat or at least match Javascript, which has been heavily optimized, but the cap is going to be something like Lua (not LuaJit) without significant, painful changes.

        If you want faster Python today, you can try numba or Cython, both solve the problem in a different way with different tradeoffs.