[m-rev.] trivial diff: Improve the performance of the automatic parallelism analysis.

Paul Bone pbone at csse.unimelb.edu.au
Thu Apr 16 16:18:13 AEST 2009


Estimated hours taken: 1.
Branches: main

Improve the performance of the automatic parallelism analysis.

Profiling this code showed that it spent 90% of it's time generating some
error messages used by some sanity checks in the coverage annotation code.
By generating these error messages only when an error occurs the performance
has been increased significantly.

deep_profiler/coverage.m:
	As above.

deep_profiler/message.m:
	Fix an incorrect capitalisation, probably caused by a typo.

Index: deep_profiler/coverage.m
===================================================================
RCS file: /home/mercury1/repository/mercury/deep_profiler/coverage.m,v
retrieving revision 1.2
diff -u -p -b -r1.2 coverage.m
--- deep_profiler/coverage.m	2 Apr 2009 09:49:27 -0000	1.2
+++ deep_profiler/coverage.m	6 Apr 2009 02:39:55 -0000
@@ -241,15 +241,21 @@ goal_annotate_coverage(Info, GoalPath, B
              s(string(GoalCoverage))], !IO)
     ),
     trace [compile_time(not flag("no_coverage_propagation_assertions"))] (
-        require(check_coverage_complete(GoalCoverage, GoalExpr),
-            string.format("check_coverage_complete failed\n" ++
+        ( check_coverage_complete(GoalCoverage, GoalExpr) ->
+            true
+        ;
+            error(string.format("check_coverage_complete failed\n" ++
                 "\tCoverage: %s\n\tGoalPath: %s\n\tProc: %s\n",
                 [s(string(GoalCoverage)), 
                  s(goal_path_to_string(GoalPath)),
-                 s(string(Info ^ cri_proc))])),
-        require(check_coverage_regarding_detism(GoalCoverage, Detism),
-            string.format("check_coverage_regarding_detism failed: %s %s",
+                 s(string(Info ^ cri_proc))]))
+        ),
+        ( check_coverage_regarding_detism(GoalCoverage, Detism) ->
+            true
+        ;
+            error(string.format("check_coverage_regarding_detism failed: %s %s",
                     [s(string(GoalCoverage)), s(string(Detism))]))
+        )
     ).
 
 :- func construct_before_after_coverage(coverage_before, coverage_after)
@@ -388,11 +394,14 @@ switch_annotate_coverage(Info, CanFail, 
     %),
 
     trace [compile_time(not flag("no_coverage_propagation_assertions"))] (
-        require(check_switch_coverage(CanFail, Cases, Before),
-            string.format("check_switch_coverage failed\n\t" ++
+        ( check_switch_coverage(CanFail, Cases, Before) ->
+            true
+        ;
+            error(string.format("check_switch_coverage failed\n\t" ++
                 "CanFail: %s\n\tCases: %s\n\tBefore: %s, After: %s\n",
                 [s(string(CanFail)), s(string(Cases)),
                 s(string(Before)), s(string(After))]))
+        )
     ).
 
     % switch_annotate_coverage_2(Info, Detism, GoalPath, CaseNum,
@@ -518,10 +527,13 @@ ite_annotate_coverage(Info, GoalPath, Be
     ),
 
     trace [compile_time(not flag("no_coverage_propagation_assertions"))] (
-        require(
+        (
             check_ite_coverage(Before, After, Before, AfterCond,
-                BeforeThen, AfterThen, BeforeElse, AfterElse, CondDetism),
-            string.format("check_ite_coverage/4 failed\n" ++
+                BeforeThen, AfterThen, BeforeElse, AfterElse, CondDetism)
+        ->
+            true
+        ;
+            error(string.format("check_ite_coverage/4 failed\n" ++
                 "\tWhole: %s %s\n" ++
                 "\tCond: %s %s\n\tThen: %s %s\n\tElse: %s %s\n" ++
                 "\tGoalPath: %s\n",
@@ -530,6 +542,7 @@ ite_annotate_coverage(Info, GoalPath, Be
                 s(string(BeforeThen)), s(string(AfterThen)),
                 s(string(BeforeElse)), s(string(AfterElse)),
                 s(goal_path_to_string(GoalPath))]))
+        )
     ).
 
 :- pred not_unify(T::in, T::in) is semidet.
Index: deep_profiler/message.m
===================================================================
RCS file: /home/mercury1/repository/mercury/deep_profiler/message.m,v
retrieving revision 1.2
diff -u -p -b -r1.2 message.m
--- deep_profiler/message.m	2 Apr 2009 09:49:27 -0000	1.2
+++ deep_profiler/message.m	6 Apr 2009 01:21:05 -0000
@@ -87,7 +87,7 @@
                 %
     ;       notice_extra_callpairs_in_conjunction(
                 int
-                    % THe number of call pairs that were not parallelised.
+                    % The number of call pairs that were not parallelised.
             )
    
                 % A pair of calls that we want to parallelise are separated by
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
URL: <http://lists.mercurylang.org/archives/reviews/attachments/20090416/9e69f84a/attachment.sig>


More information about the reviews mailing list