Skip to content

Commit

Permalink
Import Any in benchmarks failing on "No such method ==".
Browse files Browse the repository at this point in the history
  • Loading branch information
Akirathan committed Feb 8, 2023
1 parent d23d1fa commit 2bf5256
Show file tree
Hide file tree
Showing 7 changed files with 26 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,8 @@ public void initializeBenchmark(BenchmarkParams params) throws Exception {

var benchmarkName = params.getBenchmark().replaceFirst(".*\\.", "");
var code = """
import Standard.Base.Any.Any
avg fn len =
sum acc i = if i == len then acc else
sum (acc + fn i) i+1
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ public void initializeBenchmark(BenchmarkParams params) throws Exception {
var benchmarkName = params.getBenchmark().replaceFirst(".*\\.", "");
var codeBuilder = new StringBuilder("""
import Standard.Base.Data.Range.Extensions
import Standard.Base.Any.Any
type Node
C1 f1
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ public void initializeBenchmark(BenchmarkParams params) throws Exception {
var code = """
import Standard.Base.Data.Vector.Vector
import Standard.Base.Data.Array_Proxy.Array_Proxy
import Standard.Base.Any.Any
avg arr =
sum acc i = if i == arr.length then acc else
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ class AtomFixtures extends DefaultInterpreterRunner {

val millionElementList = eval(
s"""import Standard.Base.Data.List.List
|import Standard.Base.Any.Any
|
|main =
| generator fn acc i end = if i == end then acc else @Tail_Call generator fn (fn acc i) i+1 end
Expand All @@ -16,6 +17,7 @@ class AtomFixtures extends DefaultInterpreterRunner {

val generateListCode =
"""import Standard.Base.Data.List.List
|import Standard.Base.Any.Any
|
|main = length ->
| generator = acc -> i -> if i == 0 then acc else @Tail_Call generator (List.Cons i acc) (i - 1)
Expand All @@ -27,6 +29,7 @@ class AtomFixtures extends DefaultInterpreterRunner {

val generateListQualifiedCode =
"""import Standard.Base.Data.List.List
|import Standard.Base.Any.Any
|
|main = length ->
| generator = acc -> i -> if i == 0 then acc else @Tail_Call generator (List.Cons i acc) (i - 1)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ class CallableFixtures extends DefaultInterpreterRunner {
val sumTCOfromCallCode =
"""
|from Standard.Base.Data.Numbers import all
|import Standard.Base.Any.Any
|
|type Foo
|
Expand All @@ -22,7 +23,8 @@ class CallableFixtures extends DefaultInterpreterRunner {


val sumTCOmethodCallCode =
"""
"""import Standard.Base.Any.Any
|
|summator = acc -> current ->
| if current == 0 then acc else @Tail_Call summator (acc + current) (current - 1)
|
Expand All @@ -33,7 +35,8 @@ class CallableFixtures extends DefaultInterpreterRunner {
val sumTCOmethodCall = getMain(sumTCOmethodCallCode)

val sumTCOmethodCallWithNamedArgumentsCode =
"""
"""import Standard.Base.Any.Any
|
|summator = acc -> current ->
| if current == 0 then acc else @Tail_Call summator (current = current - 1) (acc = acc + current)
|
Expand All @@ -45,7 +48,8 @@ class CallableFixtures extends DefaultInterpreterRunner {
getMain(sumTCOmethodCallWithNamedArgumentsCode)

val sumTCOmethodCallWithDefaultedArgumentsCode =
"""
"""import Standard.Base.Any.Any
|
|summator = (acc = 0) -> current ->
| if current == 0 then acc else @Tail_Call summator (current = current - 1) (acc = acc + current)
|
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@ class NamedDefaultedArgumentFixtures extends DefaultInterpreterRunner {
val hundredMillion: Long = 100000000

val sumTCOWithNamedArgumentsCode =
"""
"""import Standard.Base.Any.Any
|
|main = sumTo ->
| summator = acc -> current ->
| if current == 0 then acc else @Tail_Call summator (current = current - 1) (acc = acc + current)
Expand All @@ -17,7 +18,8 @@ class NamedDefaultedArgumentFixtures extends DefaultInterpreterRunner {
val sumTCOWithNamedArguments = getMain(sumTCOWithNamedArgumentsCode)

val sumTCOWithDefaultedArgumentsCode =
"""
"""import Standard.Base.Any.Any
|
|main = sumTo ->
| summator = (acc = 0) -> current ->
| if current == 0 then acc else @Tail_Call summator (current = current - 1) (acc = acc + current)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@ class RecursionFixtures extends DefaultInterpreterRunner {
val hundred: Long = 100

val sumTCOCode =
"""
"""import Standard.Base.Any.Any
|
|main = sumTo ->
| summator = acc -> current ->
| if current == 0 then acc else @Tail_Call summator acc+current current-1
Expand All @@ -20,7 +21,8 @@ class RecursionFixtures extends DefaultInterpreterRunner {
val sumTCO = getMain(sumTCOCode)

val sumTCOFoldLikeCode =
"""
"""import Standard.Base.Any.Any
|
|main = sumTo ->
| summator = acc -> i -> f ->
| if i == 0 then acc else @Tail_Call summator (f acc i) (i - 1) f
Expand All @@ -30,7 +32,8 @@ class RecursionFixtures extends DefaultInterpreterRunner {
val sumTCOFoldLike = getMain(sumTCOFoldLikeCode)

val sumRecursiveCode =
"""
"""import Standard.Base.Any.Any
|
|main = sumTo ->
| summator = i -> if i == 0 then 0 else i + summator (i - 1)
| res = summator sumTo
Expand All @@ -39,7 +42,8 @@ class RecursionFixtures extends DefaultInterpreterRunner {
val sumRecursive = getMain(sumRecursiveCode)

val oversaturatedRecursiveCallTCOCode =
"""
"""import Standard.Base.Any.Any
|
|main = sumTo ->
| summator = acc -> i -> f ->
| if i == 0 then acc else @Tail_Call summator (f acc i) (i - 1) f
Expand Down

0 comments on commit 2bf5256

Please sign in to comment.