If you code cleanly by embedding your memblock access routines in functions, then it will be slower by around 25%. However, if you put the memblock commands directly into your code, then it will be faster than arrays by around 30%.
YMMV though, so try it yourself:
sync on
sync rate 0
make memblock 1, 1000*1000
for i = 1 to 100
Start = timer()
for y = 0 to 999
for x = 0 to 999
SetA(x, y, (x + y * y) && 0xff)
next
next
for y = 0 to 999
for x = 0 to 999
v = A(x, y)
next
next
Finish = timer()
inc Total, Finish - Start
next
print "Memblock via functions: "; Total
Total = 0
for i = 1 to 100
Start = timer()
for y = 0 to 999
for x = 0 to 999
write memblock byte 1, x + (y * 1000), v
next
next
for y = 0 to 999
for x = 0 to 999
v = memblock byte(1, x + (y * 1000))
next
next
Finish = timer()
inc Total, Finish - Start
next
print "Memblock directly: "; Total
Total = 0
dim array(999,999) as byte
for i = 1 to 100
Start = timer()
for y = 0 to 999
for x = 0 to 999
array(x, y) = (x + y * y) && 0xff
next
next
for y = 0 to 999
for x = 0 to 999
v = array(x, y)
next
next
Finish = timer()
inc Total, Finish - Start
next
print "Array: "; Total
sync off
wait key
end
function A(x as integer, y as integer)
local v as integer
v = memblock byte(1, x + (y * 1000))
endfunction v
function SetA(x as integer, y as integer, v as integer)
write memblock byte 1, x + (y * 1000), v
endfunction