shithub: mc

ref: ff88594df5c5df6fb8f227ab8e5df3529ba6e72f
dir: /bench/many-memcpy.myr/

View raw version
use std
use testr

var a : uint64[100000]

const main = {
	testr.bench([
		[.name="fwd-independent", .fn=fwd_independent],
		[.name="rev-independent", .fn=rev_independent],
		[.name="fwd-dependent", .fn=fwd_dependent],
		[.name="rev-dependent", .fn=rev_dependent],
	][:])
}

const fwd_independent = {ctx
	std.slcp(a[:a.len/2-1], a[a.len/2+1:])
}

const rev_independent = {ctx
	std.slcp(a[:a.len/2-1], a[a.len/2+1:])
}

const fwd_dependent = {ctx
	std.slcp(a[:a.len/2+1000], a[a.len/2-1000:])
}

const rev_dependent = {ctx
	std.slcp(a[a.len/2-1000:], a[:a.len/2+1000])
}