S sorex Expert Licensed User Longtime User Jan 13, 2015 #1 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
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
S sorex Expert Licensed User Longtime User Jan 13, 2015 #2 @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) Upvote 0
@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)
Erel B4X founder Staff member Licensed User Longtime User Jan 13, 2015 #3 There isn't any other way to draw part of an image. If you like upload your project and I will try it. Upvote 0
There isn't any other way to draw part of an image. If you like upload your project and I will try it.
S sorex Expert Licensed User Longtime User Jan 13, 2015 #4 I pm'ed you a link to the project. Upvote 0
Erel B4X founder Staff member Licensed User Longtime User Jan 13, 2015 #5 I highly recommend you to fix all the warnings. They are important and affect the performance. About the speed of DrawBitmap: Code: Copy Dim n As Long = DateTime.Now DrawBitmap(MyCanvas,tiles,srcrect,dstrect) Log("time: " & (DateTime.Now - n)) It takes here between 5 to 10 milliseconds. Upvote 0
I highly recommend you to fix all the warnings. They are important and affect the performance. About the speed of DrawBitmap: Code: Copy Dim n As Long = DateTime.Now DrawBitmap(MyCanvas,tiles,srcrect,dstrect) Log("time: " & (DateTime.Now - n)) It takes here between 5 to 10 milliseconds.
S sorex Expert Licensed User Longtime User Jan 13, 2015 #6 will have a look at these after lunch. Upvote 0
S sorex Expert Licensed User Longtime User Jan 13, 2015 #7 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 Upvote 0
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
stevel05 Expert Licensed User Longtime User Jan 13, 2015 #8 sorex said: 10ms * 12 items = 1.2s Click to expand... ? 10ms * 12 items = 120ms still pretty instant I think. Upvote 0
sorex said: 10ms * 12 items = 1.2s Click to expand... ? 10ms * 12 items = 120ms still pretty instant I think.
S sorex Expert Licensed User Longtime User Jan 13, 2015 #9 right, I was thinking 10 hundreds of a second. why am I getting this 2 seconds delay then? it's an iPhone 4s Upvote 0
right, I was thinking 10 hundreds of a second. why am I getting this 2 seconds delay then? it's an iPhone 4s
S sorex Expert Licensed User Longtime User Jan 13, 2015 #10 I get 124 - 141ms here per object. (debug version) Upvote 0
stevel05 Expert Licensed User Longtime User Jan 13, 2015 #11 You can't reliably measure speed in debug, it could fluctuate wildly. What is the speed in Release mode, that's the important one. Upvote 0
You can't reliably measure speed in debug, it could fluctuate wildly. What is the speed in Release mode, that's the important one.
S sorex Expert Licensed User Longtime User Jan 13, 2015 #12 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 Upvote 0
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
S sorex Expert Licensed User Longtime User Jan 13, 2015 #13 going from 113 - 127 per object, so slightly faster Upvote 0