[SOLVED] Poor draw performance on my Application



  • I am getting on average 30(35ms) for draw on the debugger. Here is a screenshot of the game:
    https://imgur.com/a/XnLv9

    Would the size of the images be the cause of high draw time or something else?

    You can click the buttons, type in the chat, add friends, block friends, send friend requests. I have several classes doing all these.

    You can also hover over buttons to change the alpha.
    All images were large originally but were scaled down.

    Another example:
    http://prntscr.com/gm3hez
    I just have a background with 3 buttons, each of size 45kb. My draw MS goes to around 4.
    These are created just using FlxButton.

    This is the new function under FlxSpriteGroup, all other functions commented out.

    public function new(x:Float, y:Float, width:Int, height:Int, url:String)
    {
    	super(x, y);
    	this.width = width;
    	this.height = height;
    	this.dispatcher = new EventDispatcher(this);
    
    	btn = new FlxButton(0, 0, "", pressed);
    	btn.loadGraphic("assets/images/cancel_request.png");
    	btn.setGraphicSize(75, 75);
    	btn.updateHitbox();
    	
    
    	this.btn.set_alpha(1);
    	
    	this.background = new MyRect(0, 0, width, height);
    	background.alpha = 0;
    
    	this.add(btn);
    	this.add(background);
    	
    }
    

    I also get 1-2ms on an empty state.

    EDIT: FlxButton was the problem. Not sure why it created such poor performance! Creating my own button class solved this issue.


  • administrators

    32 ms is ... a lot. What target is this? Any significant differences between targets?



  • I agree. I am using an HTML5 build and I have not tried other builds. I am not sure what could be wrong. An empty state causing 2ms, adding a few flx buttons causes 4ms...

    This wasn't a concern early in development until I started animating which is when I noticed it.

    I have a full friend list feature. The only animations done are when you hover over the buttons to change the alpha.

    Also I have several classes to build these features such as:

    Class A calls class B.
    Class B calls class C.
    Class C calls class D.

    Not sure if that would cause ms issues...


  • administrators

    @bronson-sedeno said in Poor draw performance on my Application:

    I have not tried other builds

    Why not? That's usually one of the first things to try with issues like this. ;)



  • @gama11

    I guess ill try it. I was trying to install android the other day with lime but I kept getting an out of memory error?

    Also does doing switchstate with FlxG do garbage collection for me?


  • administrators

    @bronson-sedeno There's plenty of targets with less setup than Android - Flash, Neko, Cpp...

    Also does doing switchstate with FlxG do garbage collection for me?

    It does trigger garbage collection eventually / indirectly, because there's no longer a reference to the old state (well, provided you're not holding onto any additional references).



  • @gama11

    The build on Neko works really well, however my primary target is HTML5.
    On Firefox MS averages about 40, and on Chrome its about 15.

    I have no idea where to start. Would appreciate some ideas. No idea what to do at this point as I a not animating anything nor am I putting things in update().



  • I just solved the problem! Thank god. FlxButton was the issue. I made my own button class and everything is down to 1-5 ms. Much much better. Not sure why FlxButton created such issues.


Log in to reply
 

Looks like your connection to HaxeFlixel was lost, please wait while we try to reconnect.