diff options
author | gwern0 <gwern0@gmail.com> | 2007-10-16 01:48:50 +0200 |
---|---|---|
committer | gwern0 <gwern0@gmail.com> | 2007-10-16 01:48:50 +0200 |
commit | 47943248fb5959182b9351bf5954f4c8fdbdd1ae (patch) | |
tree | a47e2f15c6c79c1344a2692f90c38834d65bc9e8 /tests | |
parent | 2527d001e977e346b8c70bbb61c3a828b8b82eec (diff) | |
download | XMonadContrib-47943248fb5959182b9351bf5954f4c8fdbdd1ae.tar.gz XMonadContrib-47943248fb5959182b9351bf5954f4c8fdbdd1ae.tar.xz XMonadContrib-47943248fb5959182b9351bf5954f4c8fdbdd1ae.zip |
ShellPrompt.hs: a quick optimization of nub
I saw some complaints about ShellPrompt being slow - and noticed it myself - and it seems ShellPrompt uses 'nub' in an awkward place to uniquefy input. Nub doesn't perform well on long lists, but I once ran into a similar problem and the suggested solution was something clever: convert to a Set and then back to a List. Sets can't have duplicate entries, and they uniquefy faster than nub. The price is that the output is not sorted the same as nub's output would be, but this is OK because the output of (toList . fromList) is immediately passed to 'sort' - which should then produce the same output for both versions. I haven't really tested this but on long directories this should help.
darcs-hash:20071015234850-f7719-ce02426337ffbbfb15dd1999713075c5aada81bd.gz
Diffstat (limited to '')
0 files changed, 0 insertions, 0 deletions