iOS Question messuring code execution times

sorex

Expert
Licensed User
Hello,

is there an easy way to messure code execution time?

I have the impression that drawBitmap is a lot slower on IOS than on my cheap android phone.

in B4A/Android level creation was instant, in B4i/IOS it takes 2 seconds while the phone is more powerfull?

This is when using build release app so it's not a slowdown of debugger connections
 

sorex

Expert
Licensed User
@Erel :

It seems your drawBitmap sub is causing the slowdown.

I guess it's copying the full bitmap (640x1152px tileset) each time and then trims it to what is supposed to be left.

Are there other ways to copy a bitmap source rectangle to another bitmap?
(only copying the "selected" region)
 

sorex

Expert
Licensed User
I fixed most issues but 3 of them are incorrect.
(a sub is not called but it is from in another module, and 2 for a variable that's not set but it is during the init of the class)

It is still slower than on your (faster) phone tho.

but 10ms * 12 items = 1.2s while it would be instant with a normal regional bitmap copy.

it can probably be bypassed by

using seperate images for each tile instead of 1 big tilesheet where bitmap data gets copied from

or

using a get ready or level completed screen while the level gets build in the background

so more things to keep in mind when doing games :)
 

sorex

Expert
Licensed User
right, I was thinking 10 hundreds of a second.

why am I getting this 2 seconds delay then? it's an iPhone 4s
 

stevel05

Expert
Licensed User
You can't reliably measure speed in debug, it could fluctuate wildly. What is the speed in Release mode, that's the important one.
 

sorex

Expert
Licensed User
can't read out the log like in b4a, but it take 1.5-2 seconds to build the level.

will check with an extra label, brb
 
Top