aboutsummaryrefslogtreecommitdiffhomepage
path: root/test-suite
diff options
context:
space:
mode:
authorGravatar Matthieu Sozeau <mattam@mattam.org>2018-03-08 12:26:22 -0300
committerGravatar Matthieu Sozeau <matthieu.sozeau@inria.fr>2018-06-15 15:21:52 +0200
commitbc103cc493b2127f8a570bcf2e8be94378d79a55 (patch)
tree29a04f880006aaf25a0bf7aab8892e520579163d /test-suite
parente82e8e216c4955db58255062fb5c61c7b2aa3c2a (diff)
Add test-suite case for performance, had to use Timeout
Diffstat (limited to 'test-suite')
-rw-r--r--test-suite/success/primitiveproj.v21
1 files changed, 21 insertions, 0 deletions
diff --git a/test-suite/success/primitiveproj.v b/test-suite/success/primitiveproj.v
index 31a1608c4..7ca2767a5 100644
--- a/test-suite/success/primitiveproj.v
+++ b/test-suite/success/primitiveproj.v
@@ -199,3 +199,24 @@ split.
reflexivity.
Qed.
*)
+
+(* Primitive projection match compilation *)
+Require Import List.
+Set Primitive Projections.
+
+Record prod (A B : Type) := pair { fst : A ; snd : B }.
+Arguments pair {_ _} _ _.
+
+Fixpoint split_at {A} (l : list A) (n : nat) : prod (list A) (list A) :=
+ match n with
+ | 0 => pair nil l
+ | S n =>
+ match l with
+ | nil => pair nil nil
+ | x :: l => let 'pair l1 l2 := split_at l n in pair (x :: l1) l2
+ end
+ end.
+
+Time Eval vm_compute in split_at (repeat 0 20) 10. (* Takes 0s *)
+Time Eval vm_compute in split_at (repeat 0 40) 20. (* Takes 0.001s *)
+Timeout 1 Time Eval vm_compute in split_at (repeat 0 60) 30. (* Used to take 60s, now takes 0.001s *)