• morrowind@lemmy.ml
    link
    fedilink
    arrow-up
    0
    ·
    4 months ago

    “I’m writing a recursive method with threads to optimize the CPU usage in a 0.02%” THIS IS A NONSENSICAL STATEMENT MADE BY DERANGED PEOPLE

    I mean this is correct though

    • stingpie@lemmy.world
      link
      fedilink
      arrow-up
      1
      ·
      4 months ago

      Recursion makes it cheaper to run in the dev’s mind, but more expensive to run on the computer. Subroutines are always slower than a simple jump.

      • pivot_root@lemmy.world
        link
        fedilink
        arrow-up
        1
        ·
        4 months ago

        Recursion makes it cheaper to run in the dev’s mind, but more expensive to run on the computer.

        Maybe for a Haskell programmer, divide-and-conquer algorithms, or walking trees. But for everything else, I’m skeptical of it being easier to understand than a stack data structure and a loop.

    • swab148@lemm.ee
      link
      fedilink
      arrow-up
      1
      ·
      4 months ago

      I saw an article last week about a one-liner they were adding to the Linux kernel that would reduce the startup time by .03 seconds, and let me tell you, I was relieved.

        • Dave.@aussie.zone
          link
          fedilink
          arrow-up
          1
          ·
          edit-2
          4 months ago

          There was a series of books in the '80s where a systems programmer gets pulled through a portal into your typical magical world, good vs evil, etc.

          They subsequently look at the magical spells in use and realise they can apply Good Systems Programming Practices™ to them. And thus, with their knowledge of subroutines and parallel processing, they amplify their tiny innate magical abilities up to become a Pretty Good Magician™. So while all the rest of the magicians basically have to construct their spells to execute in a linear fashion, they’re making magical subroutines and utility functions and spawning recursive spells without halting checks and generally causing havoc.

          It’s quite a good allegory for modern times, where a select few build all the magic and the rest just have useful artefacts they use on a day to day basis with no idea how they work