Jonkman Microblog
  • Login
Show Navigation
  • Public

    • Public
    • Network
    • Groups
    • Popular
    • People

Conversation

Notices

  1. Kat MCP(NT4) MCSE(Win2K) (kat@mastodon.social)'s status on Tuesday, 16-Apr-2019 10:00:12 EDT Kat MCP(NT4) MCSE(Win2K) Kat MCP(NT4) MCSE(Win2K)

    I've just done (part of) Advent of Code 2018 q9 in #Haskell. My first attempt, I thought was elegant and readable, but consumed all RAM in the universe. My second attempt, was more nuanced, throwing away all the things the solution did not really need, and this at least completed, however it takes 11 min to run.

    The second part of the question expands the problem size by a factor of 100.

    Need to think about this again!

    In conversation Tuesday, 16-Apr-2019 10:00:12 EDT from mastodon.social permalink
    1. Kat MCP(NT4) MCSE(Win2K) (kat@mastodon.social)'s status on Wednesday, 17-Apr-2019 16:16:04 EDT Kat MCP(NT4) MCSE(Win2K) Kat MCP(NT4) MCSE(Win2K)
      in reply to

      Ok, I made some changes, and it does the first part in a 0.1s now, and the second part in 7s.

      However the code looks very much like an imperative language now. There is a loop over a list inside which we do things, and use the State Monad to change things.

      The result is still slower than Python and less readable now.

      https://git.coop/kat/aoc2018/blob/master/9.hs

      #Haskell

      In conversation Wednesday, 17-Apr-2019 16:16:04 EDT from mastodon.social permalink

      Attachments

      1. 9.hs · master · kat / aoc2018
        from GitLab
        Git hosting for Co-operators
      1. Kat MCP(NT4) MCSE(Win2K) (kat@mastodon.social)'s status on Wednesday, 17-Apr-2019 16:42:32 EDT Kat MCP(NT4) MCSE(Win2K) Kat MCP(NT4) MCSE(Win2K)
        in reply to

        I suppose I should be pleased. A execution time from 11min -> 0.1 sec

        This functional programming malarky seems a bit dangerous. Making everything stateless and recursive seems nice, but picking the correct data structures and choices makes a huge difference.

        In conversation Wednesday, 17-Apr-2019 16:42:32 EDT from mastodon.social permalink
  • Help
  • About
  • FAQ
  • TOS
  • Privacy
  • Source
  • Version
  • Contact

Jonkman Microblog is a social network, courtesy of SOBAC Microcomputer Services. It runs on GNU social, version 1.2.0-beta5, available under the GNU Affero General Public License.

Creative Commons Attribution 3.0 All Jonkman Microblog content and data are available under the Creative Commons Attribution 3.0 license.

Switch to desktop site layout.