Indie game storeFree gamesFun gamesHorror games
Game developmentAssetsComics
SalesBundles
Jobs
Tags

Optimizing a window substitution function.

A topic by razetime created Nov 27, 2022 Views: 126 Replies: 2
Viewing posts 1 to 3

I am attempting to solve Advent of Code Day 21, specifically part 2 of the problem, which just asks for the same solution on the 18th iteration.

My problem is that both the grouping method used, and the method where I manually construct the grid index by index are both extremely slow. They start slowing down massively at around iteration 15, and they usually get terminated after iteration 17 is reached (oom, maybe?)

I’d like to know how to improve these functions. my code is at https://github.com/razetime/aoc/blob/main/17/21.lil.

Developer

Hmm. I'd need to look at the problem more deeply, but perhaps the Array Interface would be helpful- it provides a true mutable array of numbers, whereas Lil lists and dictionaries are all copy-on-write.

An Array interface seems.. possible? I need to figure out how to expand the grid in place while reading the grid