add benchmarks for tiny_rope in bench folder

This commit is contained in:
2024-05-28 08:01:10 +01:00
parent 9728a1ca25
commit 1f3736e690
18 changed files with 585 additions and 49 deletions

View File

@@ -14,40 +14,9 @@ struct
Vector.foldl folder Txn.empty Txn.txns
end
fun runTxnsTime () =
let
val startTime = Time.now ()
val startTime = Time.toMilliseconds startTime
val x = runTxns ()
val endTime = Time.now ()
val endTime = Time.toMilliseconds endTime
val timeDiff = endTime - startTime
val timeDiff = LargeInt.toString timeDiff
val timeTook = String.concat [timeDiff, " ms taken for " ^ Txn.title ^ " txns\n"]
val _ = (print timeTook)
in
x
end
fun write (fileName, buffer) =
let
val str = Txn.toString buffer
val io = TextIO.openOut fileName
val _ = TextIO.output (io, str)
val _ = TextIO.closeOut io
in
()
end
fun run () =
let
val buffer = runTxnsTime ()
(* The write operation guarantees that MLton doesn't optimise away the
* buffer's contents, because it has to write the contents to a file. *)
val _ = write ("out/" ^ Txn.title ^ ".txt", buffer)
val buffer = runTxns ()
in
()
end