benchmarking confusion
Stephen Weeks
MLton@sourcelight.com
Thu, 19 Jul 2001 15:30:02 -0700
> How big is the vector?
10,000 ints, i.e. 40,000 bytes. I have appended the code below.
Here are the times for another machine as well.
MhZ 400 400 733
eponym nobill starlinux
local-flatten time time time
true 7.3 7.1 3.7
false 7.8 7.4 3.5
> If it is large enough, then you can get pimped by
> caching effects.
...
> Could this explain things?
Except I don't understand why I would consistently see one executable do better
than the other on one machine, given that the assembly code (for the hot loop)
is the same.
structure Main =
struct
open Vector
fun rev v =
let
val n = length v
in
tabulate (n, fn i => sub (v, n - 1 - i))
end
fun doit () =
let
val v = tabulate (10000, fn i => i)
fun loop n =
if n < 0
then ()
else
if 0 = sub (rev (rev v), 0)
then loop (n - 1)
else raise Fail "bug"
in loop 10000
end
end
val _ = Main.doit ()