Remix.run Logo
▲ madaxe_again 41 minutes ago

Yeah, very similar. For each and every image, the code loaded every image into memory, several times each, then did a pixel-by-pixel walk through the entire image, identified all objects, and then compared all of the objects to all of the objects from all of the previous images (which it would not use the calculated result for, but rather recompute that too) to establish which one was moving - or which one was staying still.

The main fix was not making it hideously IO bound, as not only was it loading every image multiple times, it was then grinding away in swap as we’re talking tens of gigabytes of raw image data, in an era when 1gb of ram was a lot - and then making it spiral out from the last known location of the object of interest rather than brute-forcing it. My solution wasn’t even optimal, as it was literally just an afternoon of tooling around as a favour.