mirror of
https://github.com/enso-org/enso.git
synced 2024-12-23 16:15:11 +03:00
Add a benchmark for lambda performance (#81)
This commit is contained in:
parent
fec74a8925
commit
caf8808ff7
@ -17,4 +17,9 @@ public class RecursionBenchmarks {
|
||||
public void benchSumTCO() {
|
||||
recursionFixtures.sumTCO().execute(recursionFixtures.hundredMillion());
|
||||
}
|
||||
|
||||
@Benchmark
|
||||
public void benchSumTCOFoldLike() {
|
||||
recursionFixtures.sumTCOFoldLike().execute(recursionFixtures.hundredMillion());
|
||||
}
|
||||
}
|
||||
|
@ -29,6 +29,17 @@ class RecursionFixtures extends LanguageRunner {
|
||||
|
||||
val sumTCO = ctx.eval(Constants.LANGUAGE_ID, sumTCOCode)
|
||||
|
||||
val sumTCOFoldLikeCode =
|
||||
"""
|
||||
|{ |sumTo|
|
||||
| summator = { |acc, i, f| ifZero: [i, acc, @summator [@f [acc, i], i - 1, f]] };
|
||||
| res = @summator [0, sumTo, {|x, y| x + y }];
|
||||
| res
|
||||
|}
|
||||
|""".stripMargin
|
||||
|
||||
val sumTCOFoldLike = eval(sumTCOFoldLikeCode)
|
||||
|
||||
val sumRecursiveCode =
|
||||
"""
|
||||
|{ |sumTo|
|
||||
|
Loading…
Reference in New Issue
Block a user