• vrighter@discuss.tchncs.de
    link
    fedilink
    arrow-up
    9
    arrow-down
    1
    ·
    20 hours ago

    python is a language explicitly designed to resist any form of proper optimization. It just can’t be made fast

    • Corbin@programming.dev
      link
      fedilink
      English
      arrow-up
      1
      ·
      4 hours ago

      This is a common misconception! It is true that, of the Smalltalk descendants, Python was not designed for speed like Self or Java; but it was not designed to be slow or difficult to compile. The main technique required to implement a Python JIT is virtualizable objects, which allows the JIT to temporarily desynchronize the contents of registers from the contents of the heap; it’s not obvious and wasn’t in the first few iterations of PyPy. Additionally, it turns out that tracing the meta-level (see docs or the paper) is a key trick: instead of JIT’ing the Python program, the JIT operates on the interpreter, on the Python VM itself!

      • FizzyOrange@programming.dev
        link
        fedilink
        arrow-up
        2
        arrow-down
        1
        ·
        18 hours ago

        That ignores just how slow it is. It’s on the order of 100x slower than “fast” languages like Rust and Go, so doubling in speed… while nice for Python Devs doesn’t really make it fast on an absolute scale. They need to double it’s speed a few more times at least.

        • lime!@feddit.nu
          link
          fedilink
          English
          arrow-up
          3
          arrow-down
          2
          ·
          18 hours ago

          go is also not a fast language. it’s about halfway between python and c.

          but they all solve different problems so that’s ok.

          • FizzyOrange@programming.dev
            link
            fedilink
            arrow-up
            3
            arrow-down
            3
            ·
            17 hours ago

            Absolute rubbish. Go is typically something like 2-3x slower than “native” languages like C and Rust. Python is typically 50-100x times slower. Go is much much closed to C than it is to Python.

                • lime!@feddit.nu
                  link
                  fedilink
                  English
                  arrow-up
                  4
                  ·
                  16 hours ago

                  i mean, that’s what you’re supposed to do. python is a glue language, after all.

                  • FizzyOrange@programming.dev
                    link
                    fedilink
                    arrow-up
                    2
                    arrow-down
                    3
                    ·
                    12 hours ago

                    Nonsense. You are only “supposed” to do that because if you are using Python and you want performance you have no other choice!

                    Reminds me of people saying you aren’t “supposed” to store binaries in git - yeah only because git is so bad at it! When we were all using SVN people would have said “you aren’t supposed to have multiple people editing the same file simultaneously” as if it were a fundamental truth.

                    And Python isn’t “a glue language”. It’s often used like that but there are many many pure Python projects.

                  • FizzyOrange@programming.dev
                    link
                    fedilink
                    arrow-up
                    1
                    arrow-down
                    3
                    ·
                    12 hours ago

                    Nonsense. You are only “supposed” to do that because if you are using Python and you want performance you have no other choice!

                    Reminds me of people saying you aren’t “supposed” to store binaries in git - yeah only because git is so bad at it! When we were all using SVN people would have said “you aren’t supposed to have multiple people editing the same file simultaneously” as if it were a fundamental truth.

                    And Python isn’t “a glue language”. It’s often used like that but there are many many pure Python projects.