• Lysergid@lemmy.ml
    link
    fedilink
    arrow-up
    11
    ·
    edit-2
    1 year ago

    I don’t think loop vs recursion choice is what significantly impacts performance in most cases. Most of the software I saw, suffer performance because of wrong API design or overall architecture. If app needs to fetch 100 objects from API which can provide only one object at the time no optimization will save that app.

    App team - we need bulk API.

    API team - cannot because of capacity, budget, backward compatibility, DB, 3rd patry API, not a KPI

    Also it’s mostly QAs measuring performance and validating it with product guidelines which set by person who mostly detached from specific product and sometimes reality.

    • xxd
      link
      fedilink
      arrow-up
      3
      ·
      1 year ago

      I think loops tend to be faster, but well done recursion might be just as fast. I just wanted to mention performance being a point of consideration when making these decisions. I 100% agree that poor (API) architecture is probably one of the biggest reasons for slow software. It’s just that every bit of poor performance adds up along the way, and then we end up having fast computers (that are orders of magnitude faster than anything 15 years ago) running bloated electron apps (that are sometimes even slower than their equivalent 15 years ago) and it’s just frustrating.

    • spader312@lemmy.world
      link
      fedilink
      arrow-up
      1
      ·
      1 year ago

      Just adding on that recursion could be problematic if used in the wrong way, like too many calls can over flow the call stack (assuming the compiler is not able to optimize that away).