Console? good, GUI? good, game dev? use Godot engine with its similar language Gdscript, but what else? Ive been seeing AI, Data Science stuff, but whats the point if ita slow?

  • terabyterex@lemmy.world
    link
    fedilink
    arrow-up
    25
    ·
    23 hours ago

    define slow.

    my life has been in C style languages but even i kniw python us a great general purpose language. are you going to use it for high frequency trading? no but most things dont need that speed.

    yes its used a lot in ai but also for a ton of linuc scripting. i dont think anyone uses perl anymore.

    so in what way was it slow when you used it? what micro seconds were you lookong for?

    • atzanteol@sh.itjust.works
      link
      fedilink
      English
      arrow-up
      3
      ·
      21 hours ago

      Python is slow enough to notice in fairly normal usage. Just doing lookups into a dict with thousands of entries, for example, will lead you to researching how to sort and index it.

      Python’s great as an interface to C which gives it the illusion of performing well.

      • FishFace@piefed.social
        link
        fedilink
        English
        arrow-up
        6
        ·
        14 hours ago

        Yeah, want to take a bet on how long a single lookup in a dict with 5,000 entries takes on my machine?

        How to sort and index it

        It’s a hash table. Can you explain why “sorting and indexing” would improve performance?

        You’re talking out your arse.

        • atzanteol@sh.itjust.works
          link
          fedilink
          English
          arrow-up
          1
          ·
          10 hours ago

          You’re talking out your arse.

          And honestly - what do you expect for a response with a shitty attack like that? Do you need to be a dick?

        • atzanteol@sh.itjust.works
          link
          fedilink
          English
          arrow-up
          1
          ·
          10 hours ago

          I mis-remembered, it was a linear search though a list rather than a dict that was the problem (I think it was a list because we were looking up multiple entries or something from a list of Objects based on a field). O(N) lookup to be sure so not well optimized. But on list of 100,000 items doing 100,000 lookups it is very slow - > 1 minute whereas in Java it was like a few seconds.

          Yes - refactoring was the solution. I’m not saying it couldn’t perform better and it did when we re-wrote it. But that’s a low-enough number of items that it surprised me that it was a problem.

    • CarlLandry357@lemmy.worldOP
      link
      fedilink
      arrow-up
      3
      ·
      21 hours ago

      I wrote a console tictactoe game with primitive AI opponent using both Python and C++ and python takes more time in the background process before making a move than in C++.

      • Ephera@lemmy.ml
        link
        fedilink
        arrow-up
        4
        ·
        20 hours ago

        Yeah, computationally intensive stuff is going to be slow when implemented in Python. You will find lots of data science libraries for Python that do computationally intensive stuff, but they’re then generally implemented in C/C++ or Rust, with only a thin API layer written in Python.

    • ryokimball@infosec.pub
      link
      fedilink
      arrow-up
      3
      ·
      22 hours ago

      I started off with programming languages that compiled into binaries. I knew dos and bash well enough but wanted the convenience of scripting, just type in run, no compiling needed. I also wanted it to be cross-platform.

      I chose Perl. TBH I loved it, but I kept hearing about all the cool things that would come as soon as Perl 6 was released, so I started waiting, and waiting, and waiting…

      The XKCD comic, import antigravity, is literally what convinced me to try python finally. Haven’t really looked back, even 13 years later when Perl 6 was finally released

    • insomniac_lemon@lemmy.cafe
      link
      fedilink
      English
      arrow-up
      2
      ·
      edit-2
      21 hours ago

      This probably depends on what CPU someone has, someone with a higher-end CPU (higher-IPC/higher clockspeed) probably will have a better experience.

      On older/lower-end CPUs it is more common to see when something is single-threaded especially when it’s also interpreted. Particularly any type of generator/loader, filter, renderer, live audio. Which to be clear, is from a user perspective.

      • CarlLandry357@lemmy.worldOP
        link
        fedilink
        arrow-up
        1
        ·
        21 hours ago

        I think with newer CPUs Python’s current speed will be less of a problem but if your intention is game dev I think this is not enough.