From 6376d9af5db0338927a87e007ae720e41ef4071b Mon Sep 17 00:00:00 2001 From: Ian Lynagh Date: Wed, 15 Oct 2008 16:32:35 +0000 Subject: [PATCH] Fix trac #2680; avoid quadratic behaviour from (++) --- compiler/iface/MkIface.lhs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/compiler/iface/MkIface.lhs b/compiler/iface/MkIface.lhs index 2aa614c..7edf0a6 100644 --- a/compiler/iface/MkIface.lhs +++ b/compiler/iface/MkIface.lhs @@ -820,7 +820,10 @@ mk_usage_info pit hsc_env this_mod direct_imports used_names | otherwise = case nameModule_maybe name of Nothing -> pprTrace "mkUsageInfo: internal name?" (ppr name) mv_map - Just mod -> extendModuleEnv_C (++) mv_map mod [occ] + Just mod -> -- We use this fiddly lambda function rather than + -- (++) as the argument to extendModuleEnv_C to + -- avoid quadratic behaviour (trac #2680) + extendModuleEnv_C (\xs _ -> occ:xs) mv_map mod [occ] where occ = nameOccName name -- We want to create a Usage for a home module if -- 1.7.10.4