http://www.reddit.com/r/programming/comments/28mp3m/the_magic_forest_problem_revisited_optimising/ The article indicates there may be a performance problem with std.algorithm.sort