The algorithm is fast. Displaying the results is the hard part. With many permutations, browsers get quite angry trying to render the page.