Skip to content

Commit

Permalink
bump speculate requirement to v0.4.18
Browse files Browse the repository at this point in the history
most runtime is unnaffected,
but fibonacci's is 3x slower
  • Loading branch information
rudymatela committed Feb 12, 2024
1 parent b70d2d9 commit 2628d4e
Show file tree
Hide file tree
Showing 36 changed files with 396 additions and 133 deletions.
129 changes: 108 additions & 21 deletions bench/candidates.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Candidates for: foo :: Int -> Int
pruning with 27/65 rules
[3,0,8,0,30,0,194,0,1406] direct candidates, 0 duplicates
[3,3,9,10,32,39,197,247,1325] pattern candidates, 0 duplicates
pruning with 19/52 rules
[3,0,8,0,46,0,344,0,3050] direct candidates, 0 duplicates
[3,3,9,10,44,55,328,428,2681] pattern candidates, 0 duplicates

rules:
x - x == 0
Expand All @@ -17,20 +17,12 @@ x - 0 == x
(x + y) + z == x + (y + z)
(x + y) + z == y + (x + z)
x - (y - z) == z + (x - y)
(x - y) - z == x - (y + z)
(x - y) - z == x - (z + y)
(x + y) - z == x + (y - z)
(x + y) - z == y + (x - z)
(x + x) * y == x * (y + y)
x + (y - x) == y
(x - y) + y == x
x * y - x == x * (y - 1)
x * y - y == y * (x - 1)
x * (y + 1) == x + x * y
x * (y + 1) == x * y + x
(x + 1) * y == y + x * y
0 - x * y == x * (0 - y)
0 - x * y == y * (0 - x)
equations:
y * x == x * y
y + x == x + y
Expand All @@ -57,15 +49,10 @@ x * (1 - y) == x - y * x
y * (0 - x) == x * (0 - y)
(0 - x) * y == x * (0 - y)
(0 - y) * x == (0 - x) * y
(1 - y) * x == x - x * y
(1 - y) * x == x - y * x
x + (0 - y) == x - y
(0 - y) + x == x - y
x - (x + 1) == 0 - 1
x - (1 + x) == 0 - 1
y - (y + 1) == x - (x + 1)
y - (y + 1) == x - (1 + x)
y - (1 + y) == x - (1 + x)
x * (0 - 1) == 0 - x
(0 - 1) * x == 0 - x
(0 - 1) * y == x - (x + y)
Expand Down Expand Up @@ -95,8 +82,38 @@ foo x = 0 - 1

foo x = 1 - x

foo x = (x + x) - x

foo x = (x + x) - 1

foo x = (x + 1) - x

foo x = (x + 1) - 1

foo x = (1 + 1) - x

foo x = (1 + 1) - 1

foo x = x * x - x

foo x = x * x - 1

foo x = (x - 1) - x

foo x = (x - 1) - 1

foo x = (0 - x) - x

foo x = (0 - x) - 1

foo x = (0 - 1) - x

foo x = (0 - 1) - 1

foo x = (1 - x) - x

foo x = (1 - x) - 1

foo x = x + (x + x)

foo x = x + (x + 1)
Expand Down Expand Up @@ -147,6 +164,8 @@ foo x = 0 - (x + 1)

foo x = 0 - (1 + 1)

foo x = 0 - x * x

foo x = 1 - (x + x)

foo x = 1 - (x + 1)
Expand Down Expand Up @@ -227,8 +246,30 @@ foo 0 = 1
foo 1 = 1
foo x = 0

foo x = (x + x) - x

foo x = (x + x) - 1

foo x = (x + 1) - x

foo x = (x + 1) - 1

foo x = x * x - x

foo x = x * x - 1

foo x = (x - 1) - x

foo x = (x - 1) - 1

foo x = (0 - x) - x

foo x = (0 - x) - 1

foo x = (1 - x) - x

foo x = (1 - x) - 1

foo x = x + (x + x)

foo x = x + (x + 1)
Expand Down Expand Up @@ -267,6 +308,8 @@ foo x = 0 - (x + x)

foo x = 0 - (x + 1)

foo x = 0 - x * x

foo x = 1 - (x + x)

foo x = 1 - (x + 1)
Expand Down Expand Up @@ -300,9 +343,27 @@ foo x = 0 - x
foo 1 = 1
foo x = 1 - x

foo 0 = 0
foo x = (x + x) - 1

foo 0 = 0
foo x = (x + 1) - x

foo 0 = 0
foo x = x * x - 1

foo 0 = 0
foo x = (x - 1) - x

foo 0 = 0
foo x = (x - 1) - 1

foo 0 = 0
foo x = (0 - x) - 1

foo 0 = 0
foo x = (1 - x) - x

foo 0 = 0
foo x = x + (x + 1)

Expand Down Expand Up @@ -336,9 +397,36 @@ foo x = 1 - (x + x)
foo 0 = 0
foo x = 1 - x * x

foo 0 = 1
foo x = (x + x) - x

foo 0 = 1
foo x = (x + x) - 1

foo 0 = 1
foo x = (x + 1) - 1

foo 0 = 1
foo x = x * x - x

foo 0 = 1
foo x = x * x - 1

foo 0 = 1
foo x = (x - 1) - x

foo 0 = 1
foo x = (x - 1) - 1

foo 0 = 1
foo x = (0 - x) - x

foo 0 = 1
foo x = (0 - x) - 1

foo 0 = 1
foo x = (1 - x) - 1

foo 0 = 1
foo x = x + (x + x)

Expand Down Expand Up @@ -384,6 +472,9 @@ foo x = 0 - (x + x)
foo 0 = 1
foo x = 0 - (x + 1)

foo 0 = 1
foo x = 0 - x * x

foo 0 = 1
foo x = 1 - (x + 1)

Expand Down Expand Up @@ -429,7 +520,7 @@ foo x = 0 - x


Candidates for: ? :: Int -> Int -> Int
pruning with 13/33 rules
pruning with 13/29 rules
[3,3,9,18,60,162,516,1587,5148] direct candidates, 0 duplicates
[3,8,25,71,205,632,1976,6067,19140] pattern candidates, 0 duplicates

Expand Down Expand Up @@ -464,10 +555,6 @@ z + (y + x) == x + (y + z)
(z + y) * x == x * (y + z)
z * y + x == x + y * z
y * (x + x) == x * (y + y)
y + dec (dec x) == x + dec (dec y)
dec (dec x) + y == x + dec (dec y)
x + dec (dec 0) == dec (dec x)
dec (dec 0) + x == dec (dec x)

direct candidates:

Expand Down
20 changes: 16 additions & 4 deletions bench/erroneous.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Erroneous candidates for: foo :: Int -> Int
pruning with 41/82 rules
[4,8,16,42,70,162,493] candidates
30/795 erroneous candidates
pruning with 31/67 rules
[4,8,17,44,106,251,986] candidates
33/1416 erroneous candidates

foo 0 = 0
foo x = x + foo (x - 2)
Expand Down Expand Up @@ -43,6 +43,10 @@ foo 0 = 0
foo x = 1 - foo (x - 2)
-- foo 1 = bottom -- and 14 other errors

foo 0 = 0
foo x = 2 - foo (x - 2)
-- foo 1 = bottom -- and 14 other errors

foo 0 = 1
foo x = x + foo (x - 2)
-- foo 1 = bottom -- and 14 other errors
Expand Down Expand Up @@ -83,6 +87,10 @@ foo 0 = 1
foo x = 1 - foo (x - 2)
-- foo 1 = bottom -- and 14 other errors

foo 0 = 1
foo x = 2 - foo (x - 2)
-- foo 1 = bottom -- and 14 other errors

foo 0 = 2
foo x = x + foo (x - 2)
-- foo 1 = bottom -- and 14 other errors
Expand Down Expand Up @@ -123,9 +131,13 @@ foo 0 = 2
foo x = 1 - foo (x - 2)
-- foo 1 = bottom -- and 14 other errors

foo 0 = 2
foo x = 2 - foo (x - 2)
-- foo 1 = bottom -- and 14 other errors


Erroneous candidates for: ? :: Int -> Int -> Int
pruning with 13/33 rules
pruning with 13/29 rules
[3,8,25,71,205,632] candidates
26/944 erroneous candidates

Expand Down
18 changes: 9 additions & 9 deletions bench/gps.txt
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,7 @@ gps11 (cs:css) = gps11 css ++ [length cs]

gps12 :: [Int] -> Int
-- testing 6 combinations of argument values
-- pruning with 13/27 rules
-- pruning with 13/26 rules
-- looking through 2 candidates of size 1
-- looking through 5 candidates of size 2
-- looking through 2 candidates of size 3
Expand Down Expand Up @@ -262,7 +262,7 @@ gps14 xs = length (filter odd xs)

gps14 :: [Int] -> Int
-- testing 3 combinations of argument values
-- pruning with 39/58 rules
-- pruning with 37/56 rules
-- looking through 3 candidates of size 1
-- looking through 9 candidates of size 2
-- looking through 0 candidates of size 3
Expand Down Expand Up @@ -297,17 +297,17 @@ gps16 cs ds = sort cs `isSubsequenceOf` sort ds

gps17 :: Int -> Int
-- testing 4 combinations of argument values
-- pruning with 27/65 rules
-- pruning with 19/52 rules
-- looking through 3 candidates of size 1
-- looking through 3 candidates of size 2
-- looking through 7 candidates of size 3
-- looking through 8 candidates of size 4
-- looking through 28 candidates of size 5
-- looking through 35 candidates of size 6
-- looking through 179 candidates of size 7
-- looking through 217 candidates of size 8
-- looking through 1196 candidates of size 9
-- tested 492 candidates
-- looking through 40 candidates of size 5
-- looking through 51 candidates of size 6
-- looking through 299 candidates of size 7
-- looking through 383 candidates of size 8
-- looking through 2460 candidates of size 9
-- tested 826 candidates
gps17 0 = 0
gps17 x = gps17 (x - 1) + x * x

Expand Down
36 changes: 18 additions & 18 deletions bench/gps2.txt
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ gps3 :: [Char] -> Int
cannot conjure

gps4 :: [Char] -> [Char]
-- pruning with 13/20 rules
-- pruning with 13/19 rules
-- looking through 2 candidates of size 1
-- looking through 3 candidates of size 2
-- looking through 8 candidates of size 3
Expand Down Expand Up @@ -149,19 +149,19 @@ cannot conjure

gps10 :: [Int] -> Int
-- testing 7 combinations of argument values
-- pruning with 67/100 rules
-- pruning with 43/75 rules
-- looking through 4 candidates of size 1
-- looking through 16 candidates of size 2
-- looking through 0 candidates of size 3
-- looking through 68 candidates of size 4
-- looking through 80 candidates of size 5
-- looking through 1084 candidates of size 6
-- looking through 1556 candidates of size 7
-- looking through 20600 candidates of size 8
-- looking through 35632 candidates of size 9
-- tested 29538 candidates
-- looking through 76 candidates of size 4
-- looking through 88 candidates of size 5
-- looking through 1476 candidates of size 6
-- looking through 2060 candidates of size 7
-- looking through 32384 candidates of size 8
-- looking through 54360 candidates of size 9
-- tested 41332 candidates
gps10 [] = 0
gps10 (x:xs) = gps10 xs + (x `div` 3 - 2)
gps10 (x:xs) = (gps10 xs + x `div` 3) - 2

gcd :: Int -> Int -> Int
-- testing 11 combinations of argument values
Expand Down Expand Up @@ -255,14 +255,14 @@ cannot conjure

gps18_price :: [Double] -> [Double] -> Double
-- testing 4 combinations of argument values
-- pruning with 26/35 rules
-- pruning with 21/30 rules
-- looking through 2 candidates of size 1
-- looking through 8 candidates of size 2
-- looking through 32 candidates of size 3
-- looking through 74 candidates of size 4
-- looking through 433 candidates of size 5
-- looking through 1218 candidates of size 6
-- tested 1767 candidates
-- looking through 434 candidates of size 5
-- looking through 1240 candidates of size 6
-- tested 1790 candidates
cannot conjure

gps19_snowday :: Int -> Double -> Double -> Double -> Double
Expand Down Expand Up @@ -375,13 +375,13 @@ gps24 (c:cs) = if 140 > length cs

gps25 :: [Double] -> [Double] -> Double
-- testing 6 combinations of argument values
-- pruning with 31/59 rules
-- pruning with 29/53 rules
-- looking through 2 candidates of size 1
-- looking through 9 candidates of size 2
-- looking through 49 candidates of size 3
-- looking through 200 candidates of size 4
-- looking through 1104 candidates of size 5
-- looking through 5170 candidates of size 6
-- tested 6534 candidates
-- looking through 1105 candidates of size 5
-- looking through 5181 candidates of size 6
-- tested 6546 candidates
cannot conjure

Loading

0 comments on commit 2628d4e

Please sign in to comment.