In my speed example i used a DIM with structure and three bytes values inside! The DIM and AllocatedMemory size are in both examples the same!
So i will use PeekB and PokeB for the allocated memory stuff and getval=table(x,y) or table(x,y) = setval !
I am very wondering about the results! Following three lines are running inside the "write to mem and write to DIM" loop:
Code: Select all
Calculations A:
PokeB(*bitmapdatapos , 255 * (i / (width - 1.0)))
PokeB(*bitmapdatapos+1, 2)
PokeB(*bitmapdatapos+2, 255 * (j / (height - 1.0)))
Code: Select all
4781 - write to mem
641 - read from mem
---------------------------
5422 - total time
3328 - write to DIM
2500 - read from DIM
---------------------------
5828 - total time
All in one, in this example (Calculations A) direct memory access seems to be faster in its total time as DIM access! But, please compare the WriteMem and WriteDIM timing! Writing to a DIM is faster as direct memor access! But on the other side, ReadMem is x times faster as ReadDIM !? That cant be really correct, or? I am very wondering about the timing results... (have tested this x times!)
Now be wondered, when using nearly same example as topic, but changing one of the three lines of CalculationsA (i will add some more math ops, which should slow it i.e. a bit (only a little bit) down, because of some additional maths!?)
Code: Select all
Calculations B:
PokeB(*bitmapdatapos , 255 * (i / (width - 1.0)))
PokeB(*bitmapdatapos + 1, Cos(Sin(i - width / 2)) + Sin(j - height / 2))
PokeB(*bitmapdatapos+2, 255 * (j / (height - 1.0)))
Code: Select all
14844 - write to mem
625 - read from mem
---------------------------
15469 - total time
13765 - write to DIM
2625 - read from DIM
---------------------------
16390 - total time
Here is at least just an example to write datas without calculations and tested it speed!
Code: Select all
Calculations C:
PokeB(*bitmapdatapos , 2)
PokeB(*bitmapdatapos+1, 2)
PokeB(*bitmapdatapos+2, 2)
Code: Select all
2297 - write to mem
593 - read from mem
---------------------------
2890 - total time
2422 - write to DIM
2485 - read from DIM
---------------------------
3907 - total time
Also why are example A and B in writing to DIM faster as writing to memory
I am searching for a faster write access to memory for things like CalculationA and B example? (Is there a way to use PeekB and PokeB alternative in direct ASM that could be faster?



