If this really increases speed, I would also agree to this idea!
If you poke strings with PokeS(), there will be appended a null automatically; so in most cases there are no safety problems. But even if so - the programer should do what he wants to do.
31 milliseconds , and i never allocate memory 500x in one program.
Better optimize your program and don't allocate 500x
31 milliseconds is not the time to smoke a cigarete
PureBasic 5.73 | SpiderBasic 2.30 | Windows 10 Pro (x64) | Linux Mint 20.1 (x64)
Old bugs good, new bugs bad! Updates are evil: might fix old bugs and introduce no new ones.
poke and peek a slow, better use pointer, copymemory or others
PureBasic 5.73 | SpiderBasic 2.30 | Windows 10 Pro (x64) | Linux Mint 20.1 (x64)
Old bugs good, new bugs bad! Updates are evil: might fix old bugs and introduce no new ones.
There is an advantage at no costs so there's no reason to refuse to implement this. And btw. normaly I never need the memory to be zeroed - there are only very rare cases were this is usefull and I guess thats true for most projects.
And to loop this 500 times was only for Testing but I m working on
a Bitmap-Lib/2D-Engine and there I have to use many Memory allocations.
For example.
For now I'm able to load an BMP-Image with my Method realy extrem faster then with the PB-Intenals ImageLoaders.
With AllocateMemory it's equal in speed.
With allocation of 25600000 bytes in your code, AllocateMemory is faster
Okay, i think is a feature for slow machines, in most programs make this
no difference.
PureBasic 5.73 | SpiderBasic 2.30 | Windows 10 Pro (x64) | Linux Mint 20.1 (x64)
Old bugs good, new bugs bad! Updates are evil: might fix old bugs and introduce no new ones.
poke and peek a slow, better use pointer, copymemory or others
Hi ts-soft, i have read that from you several times, and from Trond too, but have you tried if there is a speed difference with the use of Peek-Poke and the use of direct pointer assignations? Just disassemble it and compare
Psychophanta wrote:Hi ts-soft, i have read that from you several times, and from Trond too, but have you tried if there is a speed difference with the use of Peek-Poke and the use of direct pointer assignations? Just disassemble it and compare
*Mem.byte = AllocateMemory(200000000)
t1 = ElapsedMilliseconds()
If *Mem
For I = 0 To 199999999
PokeB(*Mem + I, I)
Next
EndIf
t2 = ElapsedMilliseconds() - t1
t3 = ElapsedMilliseconds()
If *Mem
For I = 0 To 199999999
*Mem\b = I
*Mem + SizeOf(byte)
Next
EndIf
t4 = ElapsedMilliseconds() - t3
MessageRequester("Time:", "Poke: " + Str(t2) + #LF$ + "Pointer: " + Str(t4))
PureBasic 5.73 | SpiderBasic 2.30 | Windows 10 Pro (x64) | Linux Mint 20.1 (x64)
Old bugs good, new bugs bad! Updates are evil: might fix old bugs and introduce no new ones.
Psychophanta wrote:Hi ts-soft, i have read that from you several times, and from Trond too, but have you tried if there is a speed difference with the use of Peek-Poke and the use of direct pointer assignations? Just disassemble it and compare
*Mem.byte = AllocateMemory(200000000)
t1 = ElapsedMilliseconds()
If *Mem
For I = 0 To 199999999
PokeB(*Mem + I, I)
Next
EndIf
t2 = ElapsedMilliseconds() - t1
t3 = ElapsedMilliseconds()
If *Mem
For I = 0 To 199999999
*Mem\b = I
*Mem + SizeOf(byte)
Next
EndIf
t4 = ElapsedMilliseconds() - t3
MessageRequester("Time:", "Poke: " + Str(t2) + #LF$ + "Pointer: " + Str(t4))
Psychophanta wrote:
I got:
Poke: 9578
Pointer: 14531
Please test it without Debugger
PureBasic 5.73 | SpiderBasic 2.30 | Windows 10 Pro (x64) | Linux Mint 20.1 (x64)
Old bugs good, new bugs bad! Updates are evil: might fix old bugs and introduce no new ones.
PureBasic 5.73 | SpiderBasic 2.30 | Windows 10 Pro (x64) | Linux Mint 20.1 (x64)
Old bugs good, new bugs bad! Updates are evil: might fix old bugs and introduce no new ones.