• mlg@lemmy.world
    link
    fedilink
    English
    arrow-up
    1
    ·
    1 month ago

    Remember the olden C days before compilers got really good (and freely available) so we’d still have inline assembly everywhere for better optimization lol.

    • OwOarchist@pawb.social
      link
      fedilink
      English
      arrow-up
      1
      ·
      1 month ago

      And then there’s good old Chris Sawyer, writing an entire (fairly complex) game completely in Assembly, because he wanted the (actually kind of computationally heavy) game to still work on potato hardware.

  • BCsven@lemmy.ca
    link
    fedilink
    arrow-up
    1
    ·
    1 month ago

    Ha. I had a convo with a programmer in the 90s. He was explaining a complex problem and the steps to solve in the code, to adjust things based on user choices and parameters.

    And I said why wouldn’t you presolve all of them and then provide a lookup to go get the solution from a list. And he just looked stunned and walked away.

    • Sludge@sh.itjust.works
      link
      fedilink
      arrow-up
      1
      ·
      1 month ago

      Ah my prior manager suggested something similar… Dynamic views that would adjust based on user set parameters… We set up canned views and called it a day.

      He was let go, but always pushed for the art of the possible (even if it would take a few extra sprints to wrap)

    • Thorry@feddit.org
      link
      fedilink
      arrow-up
      1
      ·
      1 month ago

      Reminds me of the first time I saw Sin and Cos lookup tables being used in early 3D gaming. The computers could calculate those just fine, especially with a math co-processor. But for 3D gaming it would be too slow to get a good framerate. So lookup tables were used to greatly improve the speed.

      Back on those days all sort of neat tricks like that would be used. Often done as little demo programs that were very impressive. Before the internet it was hard to look up something like that and the latest and greatest tricks weren’t written in books yet. So often little code snippets and demo programs would be shared amongst programmers using the sneakernet, so we could all learn and get better.

      • xthexder@l.sw0.com
        link
        fedilink
        arrow-up
        1
        ·
        1 month ago

        Trigonometry functions are still just a hardware lookup table in most scenarios I believe. One example I’ve noticed is that you’ll get slightly different sin/cos results on AMD vs Nvidia GPUs due to either different lookup table values, or different interpolation functions being applied on top (I’m not sure it’s possible to know for sure exactly which without internal knowledge)

      • HugeNerd@lemmy.ca
        link
        fedilink
        arrow-up
        1
        ·
        1 month ago

        On 8 bit CPUs we just “refactor” the circle to have 256 degrees so you can easily use 8 bit math.

    • OwOarchist@pawb.social
      link
      fedilink
      English
      arrow-up
      0
      ·
      1 month ago

      It’s possible that the dynamic generation might be more maintainable than a lookup list, though.

      With a lookup list, you may need to recalculate the whole thing every time you make a small change. And a significant change, like giving the user a new choice/parameter to adjust, may not only require recalculating the lookup table, but also exponentially increasing the size of the lookup table.

      Whereas with a dynamically generated result, small adjustments to the values likely wouldn’t require any modification of the actual code at all, and adding a new choice/parameter would be fairly straightforward – it just needs to be plugged into the formula, maybe add an extra step or two in the algorithm.

      • BCsven@lemmy.ca
        link
        fedilink
        arrow-up
        1
        ·
        1 month ago

        It was finite, and early 90s. Calculation time is something you wanted to avoid. To put it to an analogy: you could calculate if a 3d X can be manipulated through a hole, or you can just prr evaluate and say Yes or no based on size, rather than running permutations on 6 axis of movement

  • Yaky@slrpnk.net
    link
    fedilink
    arrow-up
    1
    ·
    1 month ago

    I expected the bottom to say something like “instead of cloud-native scalable microservices using AI models that cost an average US household salary per day to run”, but maybe I’ve been in corporate for too long.

    • Tja@programming.dev
      link
      fedilink
      arrow-up
      1
      ·
      1 month ago

      Depends on the scale of the project. Some apps you would get a promotion if you could get them to (reliably) run on just 50k a day.

  • henfredemars@infosec.pub
    link
    fedilink
    English
    arrow-up
    1
    ·
    1 month ago

    It really depends on what you’re building. In an embedded shop, lookup tables are first class solutions to most problems. Computer scientists though, 100%!

    • mushroommunk@lemmy.today
      link
      fedilink
      arrow-up
      1
      ·
      1 month ago

      Depends on the available memory and size of the tables. I’ve worked on cases where time to compute didn’t matter as much as shaving off three more bytes did. Large lookup tables would have absolutely killed us compared to running some math.

      • henfredemars@infosec.pub
        link
        fedilink
        English
        arrow-up
        1
        ·
        1 month ago

        Good point! Good point.

        I’ve seen bubble sort implemented because we had data that said it was faster and was slightly smaller for the exact type data we were sorting and its expected distribution.

      • baines@lemmy.cafe
        link
        fedilink
        English
        arrow-up
        0
        ·
        1 month ago

        not doubting you because the customer can be funny but wha?

        if time to compute doesnt matter there are likely more minimal hardware options to optimize for look up tables and memory cost/space

        • mushroommunk@lemmy.today
          link
          fedilink
          arrow-up
          1
          ·
          1 month ago

          There are so many situations where you can’t just swap hardware. Robots on an assembly line? Yeah you’ve gotta use hardware that’s gone through safety testing. They’re not going to just swap hardware to make things easier. You want to ship an update, you do it in software and under strict testing regiment. Some of that hardware is 20 or 30 years old. Medical. Aeronautics. Aerospace. All of them and more are using older hardware that’s often memory limited but can often just sit and process their next step, and they often don’t have built in complex hardware features because those add potential failure points.

    • rtxn@lemmy.world
      link
      fedilink
      arrow-up
      1
      ·
      1 month ago

      IIRC, Elite used lookup tables for trigonometric functions on certain target platforms (maybe the NES) because memory wasn’t as much of a constraint as computing performance. It’s a barrel of game compressed into a pint of code.

  • Warl0k3@lemmy.world
    link
    fedilink
    arrow-up
    1
    ·
    1 month ago

    When I was a kid and my mother was teaching me to read SQL, she really drove home that Elegance is in the eye of the beholder. While a C++ dev finds beauty in reducing a signal processing step to O(n) by recursing through five lines of bitwise ingenuity, a SQL dev finds radiance in completing the task without using any loops at all.

    • Dimantina@lemmy.world
      link
      fedilink
      arrow-up
      1
      ·
      1 month ago

      Alright to anyone who would question this statement. I am a mom, and have had extremely similar conversations with my kid regarding programming and perspectives.

      Seriously it’s important for problem solving to not get caught up in perfect solutions or solutions you think are the right path be cause of your own bias’.

      Sometimes to solve a problem you are stuck on, or is proving too challenging the best course of action is to figure out why you are trying to solve it that way, and what other solutions there might be.

    • hemko@lemmy.dbzer0.com
      link
      fedilink
      English
      arrow-up
      0
      ·
      1 month ago

      When I was a kid and my mother was teaching me to read SQL

      Why would a mother do this, I’m horrified

      • Warl0k3@lemmy.world
        link
        fedilink
        arrow-up
        1
        ·
        1 month ago

        In the case of my mother, she’s pretty autistic and a very well known data scientist. This was her way of teaching me how she relates to the world - I’m quite grateful to her for it; it has given me a love of programming and allowed me get a great deal closer with her.

  • ThatGuy46475@lemmy.world
    link
    fedilink
    arrow-up
    1
    ·
    1 month ago

    A group of researchers was studying how different people solve problems. They gathered a physicist, a mathematician, and an engineer and gave them each a problem: find the volume of a red sphere. The mathematician solves it first. Asked how, he explains that he used a simple formula. The physicist solves it next. Asked how, he explains that he submerged the sphere in water and measured the rise in water level. Hours later, they find the engineer buried in paperwork. Asked about his progress, he says “I can only find a table of values for the volume of blue spheres.”

    • NaibofTabr@infosec.pub
      link
      fedilink
      English
      arrow-up
      1
      ·
      1 month ago

      On further inspection, it was found that the mathematician had assumed an ideal sphere of constant radius, while the real object was in fact oblate. The mathematician had neglected to take any measurements, leading to an incorrect value. The physicist’s answer was correct, but only at sea level at nominal temperature.

      The engineer is currently using calipers to measure the diameter of the object at many different angles in order to build a CAD model. He said we could expect results next year.

        • Omgpwnies@lemmy.world
          link
          fedilink
          English
          arrow-up
          1
          ·
          1 month ago

          Also, any CompSci grad I’ve worked with couldn’t write code for shit unless they learned how outside of their schooling, and yet so many go the CompSci -> programmer route instead of doing like SW Eng or something like that.

  • kamen@lemmy.world
    link
    fedilink
    arrow-up
    0
    ·
    1 month ago

    If you hand out a problem and only accept one solution out of multiple valid ones, you’re part of the problem.

    • SkaveRat@discuss.tchncs.de
      link
      fedilink
      arrow-up
      1
      ·
      1 month ago

      When I interview (experienced) devs, I often ask way too generic questions. Something along the lines of “can you explain what a hash is?”, without stating what kind of hash and in what context

      The primary goal isn’t really to explain it in detail, but to see if they get confused and ask for clarification. Way too many people just start assuming something, when a task is not defined properly. I need coworkers that push back on bullshit, and not blindly implement whatever runs along their desk, no matter how little sense it makes

      If I don’t hear at least one “it depends” during an interview, I don’t have high hopes

      • zalgotext@sh.itjust.works
        link
        fedilink
        arrow-up
        0
        arrow-down
        1
        ·
        1 month ago

        Your candidates aren’t mind readers though. If you want people to ask clarifying questions, you have to ask them things other than comp sci trivia questions.

        • CanadaPlus@lemmy.sdf.org
          link
          fedilink
          arrow-up
          1
          ·
          1 month ago

          It could be on a different subject, but it has to be a trick question. If they were prompted to ask more, that would undercut the whole point of the test, since OP wants employees that always ask or question.