• Ananace@lemmy.ananace.dev
    link
    fedilink
    arrow-up
    29
    arrow-down
    1
    ·
    1 year ago

    The naïve and unoptimized version ran in under 4 seconds for me, that’s nowhere near “Time to knuckle down and actually optimize this” territory.

    • Setarkus.LW@lemmy.world
      link
      fedilink
      arrow-up
      3
      ·
      1 year ago

      I was so confused just now thinking this was about day 5. Like “What the f do you consider naïve that takes less than four seconds??”

  • UlrikHDA
    link
    fedilink
    arrow-up
    15
    ·
    1 year ago

    Too scarred from puzzle 5 to do the naïve approach anymore.

  • soulsource@discuss.tchncs.de
    link
    fedilink
    arrow-up
    3
    ·
    1 year ago

    There is a trap in part 2, by the way, that can trip people who try to use maths:

    Spoiler

    The values are so large that if one uses single precision (32 bit) floating point values, the result will not be correct. Double precision floats yield the correct result.

    This means, that doing integer calculations isn’t as bad as it sounds at first.

    • bob_lemon@feddit.de
      link
      fedilink
      arrow-up
      11
      ·
      edit-2
      1 year ago

      I mean, that literally failed just yesterday.

      Also I’m not sure where in today’s problem you would even use a dictionary

      • Zagorath@aussie.zone
        link
        fedilink
        English
        arrow-up
        1
        ·
        1 year ago

        Hey, I haven’t been doing Advent this year. What was day 5’s problem and why did dicts fail?

        • bob_lemon@feddit.de
          link
          fedilink
          arrow-up
          3
          ·
          1 year ago

          There was a series of number ranges that mapped onto other ranges. The simple approach was filling dictionaries, which worked well for the example data. In the actual data, there ranges were much much larger (in the 100,000,000’s), which made the dictionaries prohibitively large.

          • Faresh@lemmy.ml
            link
            fedilink
            English
            arrow-up
            1
            ·
            1 year ago

            If each number was 8 bytes wide, it would require, if I didn’t mess up my math, 18 GB to fully represent all seeds/numbers as an array.

      • Spaghetti_Hitchens@kbin.social
        link
        fedilink
        arrow-up
        2
        arrow-down
        14
        ·
        1 year ago

        If you don’t know the meaning of a word, you can literally Google “{The word you don’t know} definition.” Google.com is a really handy and easily-accessed dictionary.

        • asyncrosaurus
          link
          fedilink
          arrow-up
          13
          ·
          1 year ago

          I can’t tell if this is a joke or a troll, buy we’re talking about a Dictionary, which is a common data structure in computer science.