• lime!@feddit.nu
    link
    fedilink
    English
    arrow-up
    3
    ·
    edit-2
    16 days ago

    alternative joke

    C++: “Hey, what’s your name?”
    Python: *grabs C++* “what is my name?”

      • anomnom@sh.itjust.works
        link
        fedilink
        English
        arrow-up
        1
        ·
        15 days ago

        Pythons weak typing means it never knows what is what. It’s up to the programmer to not screw it up.

        • Splendid4117@piefed.social
          link
          fedilink
          English
          arrow-up
          1
          ·
          15 days ago

          I think it’s more that a ton of popular python libraries (things like pandas, tensor, etc) are actually built in C, so python is just C wearing a mask

      • lime!@feddit.nu
        link
        fedilink
        English
        arrow-up
        1
        ·
        15 days ago

        one of python’s strong suits is it’s foreign function interface. it’s very easy to call code in other languages from python, which can speed execution up significantly

  • wheezy@lemmy.ml
    link
    fedilink
    arrow-up
    1
    ·
    edit-2
    16 days ago

    I know people joke around about this a lot. But I was blown away by a recent switch to I did from using cv2 with python to using cv2 with C++.

    I had literally hundreds of thousands of images to analyze for a dataset. My python script would have taken 12 hours.

    I ported it to C++ and it literally destroyed it in 20 minutes.

    I’m sure I was doing something that really wasn’t optimized well for python. I know somewhere in the backend it probably was using a completely different library with multi thread optimization. Or maybe turbojpg is just garbage in python. I’m still not even sure what the bottleneck was. I don’t know enough to really explain why.

    But holy shit. I never had that much of a performance difference in such a simple task.

    Was very impressed.

    • bobbyfiend@lemmy.ml
      link
      fedilink
      arrow-up
      1
      ·
      16 days ago

      Not having true vectorization and having to regularly code that into Python helps even the odds.

  • bobbyfiend@lemmy.ml
    link
    fedilink
    arrow-up
    1
    ·
    16 days ago

    This has got to be the best, most legitimately funny programmer/computer joke I’ve seen in years.