4 ms·
> although for some reason Gunnar's baseline is slower. Maybe I'm doing something wrong. I suspect it's because the baseline code is adding each line to a Tree
by papercrane 3y ago
> although for some reason Gunnar's baseline is slower. Maybe I'm doing something wrong.
I suspect it's because the baseline code is adding each line to a TreeMap before processing, effectively sorting 1B rows and then processing them. Your code reduces to the 413 unique stations and then sorts those.
I feel like Gunnar purposefully wrote the baseline with lots of room for improvement to encourage participation.
- mike_hearn 3y agoYes, I think you're right. The way he defines two classes for holding the results is another hint that it was built to be easily optimized :) And, well, you gotta hand it to him. That really went viral!