Table VS Memory Access

Discuss any general programming issues here
Post Reply
ArtBlink
Posts: 484
Joined: Mon Nov 01, 2010 10:37 am
Location: Albert - France
Contact:

Table VS Memory Access

Post by ArtBlink »

Hello,

I have problem, i have make a memory access speed test and i see this:

Memory acess with Peek an Poke command are slower than table command.

The speedest technique to write information is Table[number]=data

What is the utility of memory block function? because table technique is more fast and read global variable too :shock:

Some command are useless like Div(), Mul() etc...

X=Mul(2,10) is slower than X=2*10

So why do you keep these command? if you erase these command, we win in size of compiled prg and in readability, because 2 command to make the same things... keep as much faster for programm faster ;-)
User avatar
airsoftsoftwair
Posts: 5443
Joined: Fri Feb 12, 2010 2:33 pm
Location: Germany
Contact:

Re: Table VS Memory Access

Post by airsoftsoftwair »

ArtBlink wrote:Hello,
What is the utility of memory block function? because table technique is more fast and read global variable too :shock:
Memory block functions do not consume as much memory as tables because the memory block is stored as one contiguous chunk. Tables on the other hand are scattered all over the place.

Also, memory block functions can come in handy when dealing with raw data in memory. Often needed for debugging stuff.
Some command are useless like DIV(), Mul() etc...

X=Mul(2,10) is slower than X=2*10

So why do you keep these command? if you erase these command, we win in size of compiled prg and in readability, because 2 command to make the same things... keep as much faster for programm faster ;-)
These are kept for compatibility reasons. Removing them wouldn't make the program any smaller because these functions really only have a few lines of code :)
ArtBlink
Posts: 484
Joined: Mon Nov 01, 2010 10:37 am
Location: Albert - France
Contact:

Re: Table VS Memory Access

Post by ArtBlink »

Ok ;-)

But i don't understand why access table like command table[index]=[data] is much faster than Peek/Poke/call !!!!

We indicated the size of memory, but we can indicate the type of memory like GFX memory or Fast memory?
User avatar
airsoftsoftwair
Posts: 5443
Joined: Fri Feb 12, 2010 2:33 pm
Location: Germany
Contact:

Re: Table VS Memory Access

Post by airsoftsoftwair »

Peek() and Poke() are slower because these are function calls whereas table accessing is directly done by the VM.

Chip or fast memory allocation is not supported by the memory block functions because this is not needed by Hollywood.
Post Reply