large performance differences between targets
Monkey Forums/Monkey Programming/large performance differences between targets
| ||
Could someone explain why there are so big difference in running this simple application on different targets reason is using setcolor (90%) and setalpha (10%) Strict Import mojo Import monkey Function Main:Int() New MyApp Return 0 End Function Class MyApp Extends App Method OnCreate:Int() SetUpdateRate 60 Return 0 End Method OnUpdate:Int() Return 0 End Method OnRender:Int() Cls() Local AA:Int = Millisecs() For Local A:Int = 0 To 50 SetColor(50, 130, 240) SetAlpha(Rnd(0,1)) DrawRect(Rnd(10,400),Rnd(10,400),40,40) Next AA = Millisecs() - AA SetColor(255,255,255) SetAlpha(1) DrawText(1000.0 / AA,200,200) Return 0 End End android / flash (~30) is working just pathetic compared do GLWF / XNA / HTLM5 ( > 500 or infinity) is it monkey ? or is it my configuration ? |
| ||
I get the same result flash is supposed to be faster than html5? thats what confuses me. http://www.themaninblue.com/writing/perspective/2010/03/22/ Did you use the opengl version for android? |
| ||
i am using samsung galaxy ace with android 2.2 from monkey level i just run all default settings and compile this code i have no idea how to check it |
| ||
You wonder why a mobile device performs slower than a desktop? Where do you run the flash on? Desktop or what? |
| ||
no, i wonder why android and flash are slower then the "slowest" target which is html5, this isn't normal situation when html5 is 10x faster then flash on the same desktop on the same browser with just drawing colour rectangles i tested flash on desktop and apk on mobile device |
| ||
monkey uses copypixels which is a lot faster than using movieclips, http://fatal-exception.co.uk/blog/?page_id=14 |
| ||
@slenkar sorry but i don't understand how it is related to this problem ? can we consider this as a monkey bug or it is just an effect of technologies used for each target ? |
| ||
i investigated a bit and monkey seems to use bitmapdata.draw it has 'smoothing' set to true, I set it to false and its MUCH faster! basically 1.delete the build folder of your game 2.go into monkey/modules/mojo/native/mojo.flash.as 3.search for .draw 4.on each instance set the last function argument to false 5.profit! So basically flash was doing software anti-aliasing which is extremely slow. Also Flash has strange input behaviour, when you hold down a key you get repeated keydown events that accumulate in a queue. if you change mojo's as3 input commands to reflect this you get more responsive input 1.comment out these lines in endupate internal function EndUpdate():void{ //for( var i:int=0;i<512;++i ){ //keyStates[i]=0; // } charGet=0; charPut=0; } 2.alter onkeydown so that keystates simply equals 1 when pressed internal function OnKeyDown( key:int ):void{ if( (keyStates[key]==0)){//&0x100)==0 ){ keyStates[key]|=1;//0x100; //++keyStates[key]; } } 3.alter keyup so that keystate simply equals zero when released internal function OnKeyUp( key:int ):void{ keyStates[key]=0; } 4. keyboard input is much more responsive when a game slows down |
| ||
cool thanks, its working better without any quality difference (i do not scale images anyway) |
| ||
yw also do some research to find out if android is using anti-aliasing |
| ||
Galaxy tab gets about 300-500 but the overall screen is small. It doesn't fill screen. |
| ||
I noticed a similar poor performance comparison recently between HTML5 & Flash when I ran muddy_shoes' Box2D demo (http://www.monkeycoder.co.nz/Community/posts.php?topic=866). The demo was smooth on HTML5 (Chrome) but dog-slow on Flash (under Chrome also). Edit: I just tried it again, and it's alot better this time for some reason. |
| ||
Hi, This isn't a particularly good test. On targets with more HW acceleration, it's probably just measuring the time it takes to submit the render operations to the hardware - not the actual rendering time. |
| ||
how to turn on HW on android 2.2 ? OpenGL should be supported from this version |