test: more fair qsort.ml benchmark

This commit is contained in:
Sebastian Ullrich
2022-10-12 20:22:55 +02:00
parent c06cffa54f
commit 18a4b277fc
2 changed files with 4 additions and 4 deletions

View File

@@ -1,6 +1,6 @@
type elem = int32
type elem = int (* pointer-tagged like in Lean, int32 would be actually boxed *)
let badRand (seed : elem) : elem = Int32.add (Int32.mul seed 1664525l) 1013904223l
let badRand (seed : elem) : elem = seed * 1664525 + 1013904223
let mkRandomArray (seed : elem) n =
let s = ref seed in
@@ -56,7 +56,7 @@ let qsort arr =
let main n =
for _ = 0 to n-1 do
for i = 0 to n-1 do
let xs = mkRandomArray (Int32.of_int i) i in
let xs = mkRandomArray i i in
qsort xs;
checkSortedAux xs 0
done

View File

@@ -60,7 +60,7 @@ func qsortAux(_ a: inout Array<Elem>, _ low: Int, _ high: Int) {
}
func qsort(_ a: inout Array<Elem>) {
qsortAux(&a, 0, a.count - 1)
qsortAux(&a, 0, a.count - 1)
}