-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
8 changed files
with
103 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -31,3 +31,5 @@ sbt-launch.jar | |
/.worksheet/ | ||
|
||
a.out | ||
bench.bin | ||
fred.jar |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
const jar = "fred.jar" | ||
const outExe = "bench.bin" | ||
|
||
export def run [ file: string, lazyMarkScan: bool ] { | ||
let benchName = $file | path basename | ||
if $lazyMarkScan { | ||
java -jar $jar $file -o $outExe --lazy-mark-scan-only | ||
} else { | ||
java -jar $jar $file -o $outExe | ||
} | ||
let res = ( | ||
^$"./($outExe)" | ||
| lines | ||
| last | ||
| parse "Time stamp counter diff: {tsc}, clock diff: {clock}" | ||
| get 0) | ||
{ | ||
name: $benchName, | ||
tsc: $res.tsc, | ||
clock: $res.clock, | ||
lazyMarkScan: $lazyMarkScan | ||
} | ||
} | ||
|
||
export def run-all [ ] { | ||
let files = (ls benchmarks).name | ||
let myAlgo = $files | each { |file| run $file false } | ||
let lazyOnly = $files | each { |file| run $file true } | ||
$myAlgo ++ $lazyOnly | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
data Player = Player { | ||
mut friends: PlayerList, | ||
store: Store | ||
} | ||
|
||
data PlayerList | ||
= PlayerNil {} | ||
| PlayerCons { | ||
player: Player, | ||
next: PlayerList | ||
} | ||
|
||
data Store = Store { datums: Data } | ||
|
||
data Data | ||
= DataCons { | ||
value: int, | ||
// This is mut only so the compiler thinks there can be a cycle at runtime | ||
mut next: Data | ||
} | ||
| DataNil {} | ||
|
||
fn createDummyData(length: int): Data = | ||
if length == 0 then DataNil {} | ||
else DataCons { value: length, next: createDummyData(length - 1) } | ||
|
||
fn createPlayers(n: int, store: Store): PlayerList = | ||
if n == 0 then PlayerNil {} | ||
else | ||
let player = Player { friends: PlayerNil {}, store: store } in | ||
let next = createPlayers(n - 1, store) in | ||
set player.friends PlayerCons { player: player, next: next }; | ||
player.friends | ||
|
||
fn pointlessLoop(iters: int): int = | ||
if iters == 0 then 0 | ||
else | ||
createPlayers(1000, Store { datums: createDummyData(10000) }); | ||
c("processAllPCRs();"); | ||
pointlessLoop(iters - 1) | ||
|
||
fn main(): int = | ||
printf("Starting game benchmark\n"); | ||
c("float clockStart = (float) clock()/CLOCKS_PER_SEC;"); | ||
c("u_int64_t tscStart = rdtscp();"); | ||
pointlessLoop(5000); | ||
c("printf( | ||
\"Time stamp counter diff: %ld, clock diff: %lf\", | ||
rdtscp() - tscStart, | ||
((float) clock()/CLOCKS_PER_SEC) - clockStart);") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,3 @@ | ||
addSbtPlugin("org.scalameta" % "sbt-scalafmt" % "2.5.2") | ||
addSbtPlugin("com.siriusxm" % "sbt-snapshot4s" % "0.1.5") | ||
addSbtPlugin("com.eed3si9n" % "sbt-assembly" % "2.3.0") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters