From 7fd21be7f967bdc21530b730f595379b23fe1174 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Tue, 31 Jan 2017 18:40:42 -0400 Subject: Some optimisations to string splitting code. Turns out that Data.List.Utils.split is slow and makes a lot of allocations. Here's a much simpler single character splitter that behaves the same (even in wacky corner cases) while running in half the time and 75% the allocations. As well as being an optimisation, this helps move toward eliminating use of missingh. (Data.List.Split.splitOn is nearly as slow as Data.List.Utils.split and allocates even more.) I have not benchmarked the effect on git-annex, but would not be surprised to see some parsing of eg, large streams from git commands run twice as fast, and possibly in less memory. This commit was sponsored by Boyd Stephen Smith Jr. on Patreon. --- Build/OSXMkLibs.hs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'Build') diff --git a/Build/OSXMkLibs.hs b/Build/OSXMkLibs.hs index 948b0d5a3..2243c6b86 100644 --- a/Build/OSXMkLibs.hs +++ b/Build/OSXMkLibs.hs @@ -95,7 +95,7 @@ findLibPath l = go =<< getEnv "DYLD_LIBRARY_PATH" where go Nothing = return l go (Just p) = fromMaybe l - <$> firstM doesFileExist (map ( f) (split ":" p)) + <$> firstM doesFileExist (map ( f) (splitc ':' p)) f = takeFileName l {- Expands any @rpath in the list of libraries. -- cgit v1.2.3