Revert "Revert "remove some O(n^2) algorithms in the front end" [fix #2270]."

This reverts commit 1396f74efdf9a87d7c2658757f8d2b20885f67c1.
try a different implementation of delete-duplicates
Merge branch 'master' of github.com:JuliaLang/julia into jb/deleteduplicates
Merge branch 'master' of github.com:JuliaLang/julia into jb/deleteduplicates
try another delete-duplicates