The reason is that partition-by counts and thus realizes each current partition to call itself recursively.
It seems like unexpected behavior, since the user may not intend to realize the entire partition.
Approach: Change from using seq to lazy-seq in its last line
Screened-by: Alex Miller - I did a perf check too and seemed to be about the same, possibly even faster on average (gc effects mean there is a lot of deviation).
Patch as suggested by Leon, + test.