Reduce overall complexity from O(n^2) to O(n) Run time of the new benchmark is reduced from hours to 13s