Skip to content

Commit

Permalink
make List benchmark executable from harness
Browse files Browse the repository at this point in the history
  • Loading branch information
IR0NSIGHT committed Nov 6, 2023
1 parent be756fb commit b0c5c3d
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 5 deletions.
12 changes: 9 additions & 3 deletions examples/fasteffekt/harness.effekt
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ module examples/fasteffekt/harness


import examples/fasteffekt/permute
import examples/fasteffekt/list
import io/args
import text/string

Expand Down Expand Up @@ -56,16 +57,17 @@ def doRuns(innerIterations: Int, iterations: Int){benchmark: Int=>Unit} = {
def doBenchmark(name: String, inner: Int, iterations: Int) = {
if (name == "Permute") {
doRuns(inner, iterations){Permute}
} else if (name == "List") {
doRuns(inner, iterations){List}
} else {
panic("unknown benchmark")
}
}

def main() = {
def attemptBenchmarkExec(args: List[String]) = {
val debugStartTime : Int = currentTimeNanos();


["Permute","100", "100"] match {
args match {
case Cons(x, Cons(y, Cons(z, Nil()))) =>
(x, toInt(y), toInt(z)) match {
case (benchName, Some(iterations), Some(innerIterations)) =>
Expand All @@ -80,3 +82,7 @@ def main() = {
println("DEBUG: runner total took: " ++ show(runTime) ++ " us");
}

def main() = {
attemptBenchmarkExec(["List","100", "100"])
}

4 changes: 2 additions & 2 deletions examples/fasteffekt/list.effekt
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ def tail(x: Option[Element], y: Option[Element], z: Option[Element]): Option[Ele
}
}

def List() = {
def List(_: Int) = {
def benchmark(): Int = {
val result =
tail(
Expand All @@ -77,5 +77,5 @@ def List() = {
}

def main() = {
List();
List(0);
}

0 comments on commit b0c5c3d

Please sign in to comment.