Show newer

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
github.com/euank/advent-of-nic

Show thread

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.

Show thread

Though, first, as a random aside it turns out they do not yet have exhaustive tests for their stdlib. As shown by an update making a stdlib function reliably error: github.com/tweag/nickel/issues

Show thread

I haven't nickel-posted for a few days, but I have still been writing nickel for advent-of-code! So, that means, nickel thread. tl;dr: nickel is still slow, it is not fast.

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 github.com/euank/advent-of-nic ... that ended up being plenty fast.

Show thread

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 github.com/euank/advent-of-nic

Show thread

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

Show thread

Well, this time it took 4 minutes and produced 10MB of error output, so I think that means I fixed my bug but have one more. What a slow iteration speed.

Show thread

It's giving C++ a solid run for its money here. I didn't even have to use templates or metaprogramming or whatever, just passed an int to a function that takes a string

Show thread

day 2 of advent of code in nickel:

Currently nickel is taking 50 seconds to spew out 6 MBs errors.
After about line 50 it's just the same 4 lines repeated, you know, just 25k times.

It's probably right, I probably do have a type error, but it also isn't actually pointing to anywhere useful

I'll try to actually use some types and contracts for later ones. I haven't written any nickel at all before. This is an excuse to learn nickel. I should try and make myself learn the actually interesting features of nickel

Show thread

I've been saying I'll do advent of code in nickel this year. We'll see if I actually manage all the days.
Anyway, day1 is a gimme:
github.com/euank/advent-of-nic

Learnings so far:
1. Using the nickel in nixpkgs gave me an 'array.sort' that did not in fact sort arrays. nickel built from master solved that
2. sorting ~240 numbers takes nickel 2s (>100s before updating)... this does not bode well for nickel being able to do the later numerical problems.

I like the 'yamato transport' logo so much.
It's a moving/package delivery company, and the logo is a cat transporting a kitten.
:kitten:🐱 (aww, no kitten emoji :( )

"The Gym told you to reject the evidence of your eyes. It was their final, most essential, step to making this route less confusing" - George Orwell's review of this black bouldering route at SBP

Looking at the list of prohibited items this moving company sent me:

> Items that cannot be shipped
> Documents/Books - Pornography and Political Documents
No political books, I bet that's easy to determine.

> Others - ... • Drugs • Large quantities of drugs
Seems redundant to have both those bullet points, but at least that seems easier to define.

mildly indecent language 

also, I uh.. I did not expect an example sentence like this from such a totally innocent google search. The result at the bottom of the image.

Show thread

> Cruces, the formal plural of crux
en.wikipedia.org/wiki/Cruces

... sorry, what, _formal_ plural?
Like if you're at a fancy party you have to say "You see, the cruces of the matter are X and Y", but on the street you can just say "The cruxes are.."?

It's been another 6 months, the intervals are getting shorter!
I might actually be back for real!

Except also my life is going to be hectic with moving for the next ~month-ish. Does that mean no time to post? Does that mean stress-posting? Dear follower, if you don't click the unfollow button, we can find out together

Show thread
Show older
Wobscale Social

wobscale.social - a server for friends of the Wob, affiliated with Wobscale Technologies