lang: Add tests for slow unification
These used to be cases where our algorithm was unusably slow. Thanks to foxxx0 for the report!
This commit is contained in:
31
lang/interpret_test/TestAstFunc2/slow-unification1.output
Normal file
31
lang/interpret_test/TestAstFunc2/slow-unification1.output
Normal file
@@ -0,0 +1,31 @@
|
||||
Vertex: print[flipflop-a]
|
||||
Vertex: print[flipflop-b]
|
||||
Vertex: print[flipflop-bar]
|
||||
Vertex: print[flipflop-c]
|
||||
Vertex: print[flipflop-d]
|
||||
Vertex: print[flipflop-e]
|
||||
Vertex: print[flipflop-f]
|
||||
Vertex: print[flipflop-foo]
|
||||
Vertex: print[flipflop-g]
|
||||
Vertex: print[flipflop-h]
|
||||
Vertex: print[flipflop-hello world]
|
||||
Vertex: print[flipflop-i]
|
||||
Vertex: print[flipflop-j]
|
||||
Vertex: print[flipflop-k]
|
||||
Vertex: print[flipflop-l]
|
||||
Vertex: print[flipflop-m]
|
||||
Vertex: print[flipflop-meep]
|
||||
Vertex: print[flipflop-moop]
|
||||
Vertex: print[flipflop-n]
|
||||
Vertex: print[flipflop-o]
|
||||
Vertex: print[flipflop-p]
|
||||
Vertex: print[flipflop-q]
|
||||
Vertex: print[flipflop-r]
|
||||
Vertex: print[flipflop-s]
|
||||
Vertex: print[flipflop-t]
|
||||
Vertex: print[flipflop-u]
|
||||
Vertex: print[flipflop-v]
|
||||
Vertex: print[flipflop-w]
|
||||
Vertex: print[flipflop-x]
|
||||
Vertex: print[flipflop-y]
|
||||
Vertex: print[flipflop-z]
|
||||
43
lang/interpret_test/TestAstFunc2/slow-unification1/main.mcl
Normal file
43
lang/interpret_test/TestAstFunc2/slow-unification1/main.mcl
Normal file
@@ -0,0 +1,43 @@
|
||||
import "datetime"
|
||||
import "math"
|
||||
|
||||
class foo($bar) {
|
||||
$now = datetime.now()
|
||||
$x = math.mod($now, 2)
|
||||
print "flipflop-${bar}" {
|
||||
msg => if $x == 0 { "FLIP" } else { "FLOP" },
|
||||
}
|
||||
}
|
||||
|
||||
# Increasing the number of these, used to cause the performance to tank after 5.
|
||||
include foo("hello world")
|
||||
include foo("meep")
|
||||
include foo("moop")
|
||||
include foo("foo")
|
||||
include foo("bar")
|
||||
include foo("a")
|
||||
include foo("b")
|
||||
include foo("c")
|
||||
include foo("d")
|
||||
include foo("e")
|
||||
include foo("f")
|
||||
include foo("g")
|
||||
include foo("h")
|
||||
include foo("i")
|
||||
include foo("j")
|
||||
include foo("k")
|
||||
include foo("l")
|
||||
include foo("m")
|
||||
include foo("n")
|
||||
include foo("o")
|
||||
include foo("p")
|
||||
include foo("q")
|
||||
include foo("r")
|
||||
include foo("s")
|
||||
include foo("t")
|
||||
include foo("u")
|
||||
include foo("v")
|
||||
include foo("w")
|
||||
include foo("x")
|
||||
include foo("y")
|
||||
include foo("z")
|
||||
@@ -0,0 +1,6 @@
|
||||
Vertex: print[/tmp/some-module-foo-flipflop]
|
||||
Vertex: print[/tmp/some-module-foo]
|
||||
Vertex: print[/tmp/some-module-hello world-flipflop]
|
||||
Vertex: print[/tmp/some-module-hello world]
|
||||
Vertex: print[/tmp/some-module-meep-flipflop]
|
||||
Vertex: print[/tmp/some-module-meep]
|
||||
@@ -0,0 +1,13 @@
|
||||
import "datetime"
|
||||
import "math"
|
||||
|
||||
class foo($bar) {
|
||||
$now = datetime.now()
|
||||
print "/tmp/some-module-${bar}" {
|
||||
msg => if datetime.weekday($now) == "friday" { "TGIF YAY!" } else { "meh..." },
|
||||
}
|
||||
$x = math.mod($now, 2)
|
||||
print "/tmp/some-module-${bar}-flipflop" {
|
||||
msg => if $x == 0 { "FLIP" } else { "FLOP" },
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
# reported by foxxx0
|
||||
import "classes.mcl" as baz
|
||||
include baz.foo("hello world")
|
||||
include baz.foo("meep")
|
||||
include baz.foo("foo")
|
||||
Reference in New Issue
Block a user