Web client room view pegging CPU/browser always


  • Dev Team

    We’ve deployed some animation optimizations (including translateZ(0) force switch), please confirm if you see any improvement.


  • Culture

    In the simulator, while paused, still uses 1 core fully on my computer.

     

    http://i.imgur.com/xTPCnGo.png


  • Dev Team

    Can we have a look at the screenshot of your room layout in the simulator at that moment?


  • Culture

    http://i.imgur.com/pPjHLHa.png

     

    You can use this script to magically load any room into the simulator:

    https://github.com/ButAds/SimulationRoomLoader

     

    It's room W3N11 from the world.


  • Dev Team

    Does displaying the real W3N11 room produce the same thing?


  • Culture

    yes, same results:

    http://i.imgur.com/INm3B5a.png

     

    Can't pause it though 😕


  • Dev Team

    I'm unable to reproduce this. Have you tried an incognito window setup without any extensions/userscripts?


  • Culture

    In  incognito:

    http://i.imgur.com/xAKdkhI.png

     

    Might be related that 

    transform: translateZ(0);

    is not handled by GPU's if they don't support it.


  • Dev Team

    In the paused simulation room it doesn't matter, there should be no position transforms. Could you try to start removing all object types (towers, spawns, etc) from the sim room and check if this makes it any better?


  • Culture

    I got it down to 6% CPU after removing the following structures:

     

    Spawn

    Tower

    Observer

    Powerspawn

    Sources

     

     


  • Culture

    No creeps were in the room:

     

    http://i.imgur.com/D23zKQo.png


  • Dev Team

    Any particular structure type? Or all of these should be removed altogether?


  • Culture

    Narrowed it down to the following:

    Active Spawners

    Energy sources 

    Observer

     

    Adding either of these to the room increases CPU to a full core.


  • Culture

    As soon as tower start rotating around it will immediately jump to 1 full CPU as well.


  • Dev Team

    So, basically, all elements with active SVG animations, which is very strange. There are some serious issues with them in your browser setup. Let's move this debugging session to private, please create a support ticket.


  • Culture

    Artem if you add translateZ(0) you have to make sure the draw order is correct. Right now containers is draw on top of creeps.


  • Dev Team

    Artem if you add translateZ(0) you have to make sure the draw order is correct. Right now containers is draw on top of creeps.

    There was a typo in z-index style which is already fixed. Try to reload the page.


  • Culture

    Hi!

    I'm fairly certain it's not a browser setup issue. My test setup:

     * A ubuntu 15.10 (later 16.04), existing machine, latest chrome. Just ublock and flash disabled.

     * A brand new ubuntu 14.04 laptop, completely fresh unaltered install + latest chrome.

     * A completely brand new computer with a fresh windows 10 install + latest chrome.

    From what I can tell this is related to: If anything in the room is animating, and the number of objects in the room. In example:

    Using the room history viewer, which isn't getting websocket updates, and is by default paused, look at:

    1) A completely empty room (like one to my west that runs inbetween quads), CPU usage is low.

    2) An unused room with a single source in it. CPU usage is a bit higher (makes some sense, something is animating)

    3) Then, look at one of my own rooms with roads, extensions, etc, in it. Paused at a point where the only animations are from the sources. CPU usage is now maxed. No tower movement, no spawn movement, no creep movement (again, the "room history" view is used while paused)

    When looking at timeline profiles in chrome it shows that .apply() is being called on objects nearly constantly. It appears that if anything is animating in a room, anything which could potentially have animations layered on top of it gets .apply called to it. It's difficult to troubleshoot from there due to everything being minified.

    Hope this helps, thank you!


  • Dev Team

    apply() has nothing to do with this subject. The browser loops SVG animations automatically regardless of application scripts. We'll try to get into this a bit deeper, but it's quite hard to debug, since first we need to find a reproducible scenario of such 100% CPU load case.



  • I noticed that with the new update, the towers rotate very jerkily. Before, they would rotate smoothly, but now they rotate a lot when the tick updates, and then remain still for the rest of the tick.

    (I use Chrome 52.0.2743.116 m on Windows 10).