Yea, my first attempt was to use a set for `r.chunks`, and then convert it back at the end of the function w/ `Array.from` this was only marginally faster than the original code though. IIRC the `Array.from` calls were taking ~12 seconds.

I can create another profile showing that if you want.