I'm a fan of the new ninja+rust build system, very generate-ninja vibes, and definitely made packaging it for nix easier than the old setup. I failed several times to get a working bazel-based package there, and this one only took like 5 hours total of banging my head against silly issues and waiting for rust to build.
I'll add another one, since it hit me again today:
If I put the screen to sleep (tapping the power button) and change the volume up or down too near to each other, the volume gets "stuck" going up or down, and either goes to 0 or blasts my ears.
Another for the list:
Progressive web apps seem to only be addable to the home screen from safari. The "share" button on firefox-for-ios just doesn't have the option.
This came up because Japan's immigration app is a PWA now (awesome!), which meant I had to open safari-for-iphone for the first time in months (bleh), since I kinda do want offline access to this one.
2. It took me over a year to figure out that I could make my alarm fade in by going through setup in the health app... which now makes a special "sleep" alarm show up in the alarm app, which does fade in. But also has a different ux to set it and can only be set in increments of 5 minutes?
I would not have ever found this special type of alarm that does fade in by default if I hadn't googled this.
The health app changing the options in alarm app feels bonkers.
To start with, I'll do the two that stick out the most:
1. iOS limits you to 1 timer at a time. On my android phone "Okay google, set a timer for 10 minutes. Okay google, set a timer for 20 minutes" resulted in two timers. iOS will only let you replace the older one. This still bugs me since it changes how I cook a bit.
Unfortunately, just having a faster foldl has not been enough to make day11 complete.
At this point, my day11 solution uses all my ram (64 gigs) for something like 25 "rounds", and part2 requires 10k rounds. I feel like this really might be the point where I have to start improving the interpreter itself since that memory usage is just ridiculous.
I'm going to try and get it to work without interpreter changes a bit more since I do have some ideas to try still...
That realization has let me write a foldl that has a call stack depth of 2, rather than O(n), which honestly has solved the performance issues for half the days so far
My main realization since last time was that function calls appear to have a cost based on their call depth, and that dwarfs basically all else once you hit several hundred calls deep.
Which, given that it's a functional language, even just finding the max of an array is typically a `fold` operation recursive to the depth of the array. There's no TCO or anything to make it efficient.
Or oops, there was a methodology error in there.
The first one is 2 minutes and ~4GiB of ram, not 2s. I was accidentally leaving part of it un-evaluated.
Still, a darn sight better than the foldl bit.
Ultimately I ended up with this non-foldl max https://github.com/euank/advent-of-nickel-2022/blob/689b48a0b/lib.ncl#L33-L38 ... that ended up being plenty fast.
Learnings from day 8 for advent of code in nickel:
`array.fold` is slow on larger lists in nickel. Very slow.
Time to process day 8's input into a list of ~10k numbers: 2 seconds & ~250MiB of ram
Time to find the max in that list using `array.foldl num.max 0 list`: oomkilled after 2 hours for using >60GiB of ram
I skipped posting these for a couple days since day 3 and 4 were pretty boring.
Day 5 again makes me afraid i may not complete all of them in nickel. My part 1 code took 60GiB of ram (I've only got 64!)
Either way, when AoC is done, I'll go upstream and drop a note about all the functions that weren't in the stdlib, but felt sorta like they could be https://github.com/euank/advent-of-nickel-2022/blob/e9bf74982/lib.ncl
On the bright side, I found my bug and it gave the correct answer.
However, the ~4GiB RSS and ~4 minutes of spinning a core is uh.. I dunno, seems like a lot for basically adding up 2500 numbers.
Done posting about today's AoC
wobscale.social - a server for friends of the Wob, affiliated with Wobscale Technologies