The above script is faster with small amounts of data, but dramatically slows down as the number of items increase.
10,000 items - 1 second (Speeds were timed with a stopwatch so are only a guide.)
20,000 items - 2 seconds
40,000 items - 4 seconds
80,000 items - 14 seconds
160,000 items - 50 ...