[m-rev.] for review: speedup some dependency computation in mmc --make
Peter Wang
novalazy at gmail.com
Wed Jun 25 12:44:12 AEST 2008
(!)
Branches: main
Fix pathological (?) behaviour in the computation of dependencies
by `mmc --make'.
In one workspace, `mmc --make' now takes 2 seconds to check that all the .c
files in the compiler directory are up to date. Previously, it took 132
seconds.
compiler/make.dependencies.m:
In find_transitive_implementation_imports, accumulate dependencies
starting from a singleton set, instead of accumulating from an empty
set and adding that single element afterwards.
Index: compiler/make.dependencies.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/make.dependencies.m,v
retrieving revision 1.47
diff -u -p -r1.47 make.dependencies.m
--- compiler/make.dependencies.m 27 Mar 2008 02:29:41 -0000 1.47
+++ compiler/make.dependencies.m 25 Jun 2008 02:33:21 -0000
@@ -823,7 +823,7 @@ init_cached_transitive_dependencies = ma
find_reachable_local_modules(ModuleName, Success, Modules, !Info, !IO) :-
find_transitive_module_dependencies(all_dependencies, local_module,
- ModuleName, Success, Modules, !Info, !IO).
+ ModuleName, Success, set.init, Modules, !Info, !IO).
:- pred find_transitive_implementation_imports(module_name::in, bool::out,
set(module_name)::out, make_info::in, make_info::out,
@@ -831,9 +831,9 @@ find_reachable_local_modules(ModuleName,
find_transitive_implementation_imports(ModuleName, Success, Modules,
!Info, !IO) :-
+ Modules0 = set.make_singleton_set(ModuleName),
find_transitive_module_dependencies(all_imports, any_module,
- ModuleName, Success, Modules0, !Info, !IO),
- Modules = set.insert(Modules0, ModuleName).
+ ModuleName, Success, Modules0, Modules, !Info, !IO).
:- pred find_transitive_interface_imports(module_name::in, bool::out,
set(module_name)::out, make_info::in, make_info::out,
@@ -841,19 +841,20 @@ find_transitive_implementation_imports(M
find_transitive_interface_imports(ModuleName, Success, Modules, !Info, !IO) :-
find_transitive_module_dependencies(interface_imports, any_module,
- ModuleName, Success, Modules0, !Info, !IO),
+ ModuleName, Success, set.init, Modules0, !Info, !IO),
set.delete(Modules0, ModuleName, Modules).
:- pred find_transitive_module_dependencies(transitive_dependencies_type::in,
- module_locn::in, module_name::in, bool::out, set(module_name)::out,
- make_info::in, make_info::out, io::di, io::uo) is det.
+ module_locn::in, module_name::in, bool::out, set(module_name)::in,
+ set(module_name)::out, make_info::in, make_info::out, io::di, io::uo)
+ is det.
find_transitive_module_dependencies(DependenciesType, ModuleLocn,
- ModuleName, Success, Modules, !Info, !IO) :-
+ ModuleName, Success, Modules0, Modules, !Info, !IO) :-
globals.io_lookup_bool_option(keep_going, KeepGoing, !IO),
find_transitive_module_dependencies_2(KeepGoing,
DependenciesType, ModuleLocn, ModuleName,
- Success, set.init, Modules, !Info, !IO),
+ Success, Modules0, Modules, !Info, !IO),
DepsRoot = transitive_dependencies_root(ModuleName, DependenciesType,
ModuleLocn),
!:Info = !.Info ^ cached_transitive_dependencies ^ elem(DepsRoot)
--------------------------------------------------------------------------
mercury-reviews mailing list
Post messages to: mercury-reviews at csse.unimelb.edu.au
Administrative Queries: owner-mercury-reviews at csse.unimelb.edu.au
Subscriptions: mercury-reviews-request at csse.unimelb.edu.au
--------------------------------------------------------------------------
More information about the reviews
mailing list