Raw pixel performance version 1.11 to 1.35 slowdown?

BlitzPlus Forums/BlitzPlus Programming/Raw pixel performance version 1.11 to 1.35 slowdown?

The forum is locked. These are the original blitzbasic.com forums, kept so they can still be read. No new topics, replies or edits can be made here. To join in, head over to the Blitz3D+ forums.

Below is a code sample that runs much slower on versions 1.35 and 1.34 compared to version 1.11.

Basically it uses ReadPixelFast and WritePixelFast on an image bufer and the canvas.

The numbers I get are
version 1.11 - 1900 millisecs
version 1.35 - 14500 millisecs

That's about 7x slower.

I thought perhaps it was the canvas operations, but commenting out the write to the canvas is still slower.
version 1.11 - 600 millisecs
version 1.35 - 900 millisecs

I suspect I'm doing something wrong but I don't know what.


; Simple Speed test of read and write pixels

Const EVENT_MOUSEDOWN = $201
Const EVENT_CLOSE = $803

Const IMAGE_WIDTH = 400
Const IMAGE_HEIGHT = 400

; Create a main window
window = CreateWindow ("Speed Test of raw pixel ops", 0, 0, ClientWidth(Desktop()), ClientHeight(Desktop()))

If window

; Create panel
panel = CreatePanel (0, 0, ClientWidth(window), ClientHeight(window), window, 1)
SetPanelColor panel, 64, 64, 64
SetGadgetLayout panel, 1, 1, 1, 1

; Create drawing canvas
canvas = CreateCanvas (0, 0, IMAGE_WIDTH, IMAGE_HEIGHT, panel)
SetGadgetLayout canvas,1,1,1,1

; Create image buffer
ibuffer = CreateImage (IMAGE_WIDTH, IMAGE_HEIGHT)
SetBuffer ImageBuffer (ibuffer)

; Main event loop...
Repeat

; Wait for a window event...
e = WaitEvent ()

; Process the event...
If e = EVENT_MOUSEDOWN Then

LockBuffer CanvasBuffer(canvas)
LockBuffer ImageBuffer(ibuffer)

startTime = MilliSecs()

For count = 0 To 100
For y = 0 To IMAGE_HEIGHT
For x = 0 To IMAGE_WIDTH
rrgb = ReadPixelFast(x,y)
WritePixelFast x,y,rrgb

SetBuffer CanvasBuffer (canvas)
WritePixelFast x,y,rrgb
SetBuffer ImageBuffer (ibuffer)
Next
Next
Next

UnlockBuffer CanvasBuffer(canvas)
UnlockBuffer ImageBuffer(ibuffer)

endTime = MilliSecs()
Print endTime - startTime

FlipCanvas (canvas)
EndIf
If e = EVENT_CLOSE Then End
Forever

Else
Notify ("Failed to create window!", True)
End
EndIf