3 ms·
Sure. However, it does represent problems I've seen before with "overly" (subject to the person, I guess) complex solutions that end up being significantly less
by atto 14y ago
Sure. However, it does represent problems I've seen before with "overly" (subject to the person, I guess) complex solutions that end up being significantly less efficient. In this case, the problem is actually the `.toSet`, which forces a second iteration of the dataset. If the Monoid class was rewritten (yes, to be less mathematically pure) to use Seqs, it's nearly identical performance (as expected) as the linear solution.
Fun performance graph: http://i.imgur.com/2rOvb6V.png http://i.imgur.com/2rOvb6V.png
- greendestiny 14y agoThat is interesting. Personally I didn't find framing the original problem as monoid enlightening at all, but that's what I thought the author was getting at.