minor performance tuning;
authorwenzelm
Tue, 13 Aug 2019 21:18:26 +0200
changeset 70526 bb18c7ac9cff
parent 70525 1615b6808192
child 70527 095e6459d3da
minor performance tuning;
src/Pure/Syntax/syntax.ML
--- a/src/Pure/Syntax/syntax.ML	Tue Aug 13 20:54:08 2019 +0200
+++ b/src/Pure/Syntax/syntax.ML	Tue Aug 13 21:18:26 2019 +0200
@@ -549,15 +549,17 @@
       print_ast_trtab = print_ast_trtab2, prtabs = prtabs2} = tabs2;
 
     val (input', gram') =
-      (case subtract (op =) input1 input2 of
-        [] => (input1, gram1)
-      | new_xprods2 =>
-          if subset (op =) (input1, input2) then (input2, gram2)
-          else
-            let
-              val input' = new_xprods2 @ input1;
-              val gram' = Lazy.lazy_name "Syntax.merge_syntax" (fn () => Parser.make_gram input');
-            in (input', gram') end);
+      if pointer_eq (input1, input2) then (input1, gram1)
+      else
+        (case subtract (op =) input1 input2 of
+          [] => (input1, gram1)
+        | new_xprods2 =>
+            if subset (op =) (input1, input2) then (input2, gram2)
+            else
+              let
+                val input' = new_xprods2 @ input1;
+                val gram' = Lazy.lazy_name "Syntax.merge_syntax" (fn () => Parser.make_gram input');
+              in (input', gram') end);
   in
     Syntax
     ({input = input',