Web client room view pegging CPU/browser always


  • 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).


  • Dev Team

    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.

    This is intended. They now rotate every 10 seconds (not every tick) to random positions.


  • Dev Team

    We've just added new "Smooth animations" display option on the PTR. Please try disabling it and check whether it makes any difference. Also, please check the scenario when a lot of creeps are moving simultaneously, i.e. when the position change animation happens.


  • Culture

    Hi!

    Just gave the smooth animations button a try on the PTR. It does seem to halve the CPU usage.

    Did some quick tests in the sim as well:

    45% CPU with few creeps and not much going on.

    75% CPU with 40 extensions near creeps (and a few more? like 5)

    85-95% CPU with 12 creeps and say bubbles.

    Adding tons of roads near where animations happens ups it to 110%.

    Tons of roads, 40 extensions, 12 creeps, and paused (only things animating are sources and keeper lairs) is using 50% CPU.

    Re-enabling smooth animations at any point seems to max out CPU (100%-130% is as far as the browser tab goes on this machine).

     

    Can't tell if the combination of animations or animations-near-things-that-get-redrawn are causing more of the problems. This switch certainly helps in the meantime!


  • Dev Team

    Well, I forgot to mention that in case of the simulation all tests should be performed in the paused state. Otherwise it is unclear what uses the resources - browser rendering or the simulation computation itself.


  • Culture

    I see a small CPU-drop when using the option in the off position. It's about 2% less. It could be that the CPU was hammered first, and now has some idle time. I'm assuming it's consuming less cpu-resources.

    I can't test the new option in simulator as the button isn't there yet. So no reliable "no-tick-cpu-usage" indication yet. It definitely feels less jittery while dragging the map around compared to the smooth-animation one.


  • Dev Team

    I can’t test the new option in simulator as the button isn’t there yet

    What do you mean? This button should be available in the simulation on the PTR, the UI is the same there.


  • Culture

    I never knew there was a simulation-ptr. Always assumed it was 1 simulation page.

    My migrate room script doesn't work for PTR sadly, so can't test migrating W3N11 to there.


  • Dev Team

    You could just try to put a lot of animated structures manually, and don't forget to pause the simulation execution.


  • Culture

    SIM - With smooth animations: http://i.imgur.com/6Z3MmWd.png

     

    SIM - Without smooth animations: http://i.imgur.com/J0MbxNZ.png


  • Culture

    Hi, sorry, that was the quickest way for me to test many creeps moving around.

    The sim, while paused, seems to sit at 30-35%, even after I've put a number of buildings up.

    Is there any chance for one more hopefully small adjustment to the smooth animations option? When disabled, could "Ambient" animation loops (energy, source keeper, spawning spawn, reserved/degrading controller, etc) only make a 1 second loop once at the top of any tick?

    That would allow a full pause in animations between per-tick animations, allowing the CPU to go into a deeper sleep state temporarily. This should help a lot for laptops. In public there's a 0.5 to 1s space between animations for previous tick and the next tick starting, so this would be perfect.

    Thank you! This already helps a lot.