First unrounded position placement causes fps&cpu spike
Reported by
hexerdo...@gmail.com,
Dec 5
|
||||||
Issue descriptionUserAgent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/71.0.3578.80 Safari/537.36 Steps to reproduce the problem: 1. Navigate https://snipg.github.io/Bugs/Unround_Bug/ 2. After 5 sec, sprite is moved without decimal point X and Y(X 500, Y 300) - See no lag 3. 4 sec after first move, sprite is moved again with decimal point position X and Y(something like X 130,435345,Y 200,34234234) - See FPS and cpu spike What is the expected behavior? No FPS or CPU spike, when object is placed with decimal point value. What went wrong? First time project uses Decimal point value to place some object, there is huge fps and cpu spike. All following position that use decimal point value do not affect fps or cpu, its just first time it is used Did this work before? N/A Does this work in other browsers? Yes Chrome version: 71.0.3578.80 Channel: stable OS Version: 10.0 Flash Version: Project has static invisible object in background, put some pressure on cpu, so that this bug shows up better. Bug can be reproduced with just single object to, but on faster PC the spike will go unnoticed. Does not matter how i try, this lag spike won't show up on Firefox or Edge.
,
Dec 6
Able to reproduce the issue on reported chrome version #71.0.3578.80, latest chrome #73.0.3632.0 using Windows 10, Mac 10.12.6 and Ubuntu 17.10. Observed that there was CPU hike after sprite moved with decimal point position. The behaviour is observed from M-60(#60.0.3112.113), attaching screencast for reference. This is non-regression issue hence marking it as untriaged and requesting someone from the dev team to look into the issue. Thanks.!
,
Dec 10
,
Dec 11
Does anyone on the team have insight as to what we do differently on sub-pixel positioning? Or is it just that position change triggers compositing and we do a layer update? Setting a short Next Action so I can look in the case of nobody jumping in sooner.
,
Dec 11
I add some info how this bug showed up, maybe it helps. Using Construct 3 engine and if i had thousands of object on layout. And now when i moved 1 object with touchX/Y , i had huge cpu&fps spike. User input with mouse/touch was always something like X/Y 102,4567. But when i added, for example round(touch.X) there was no lag spike. It seems it lagged only once for first time when unrounded number was used. Same case happens when i build layout object into grid so they have all rounded positions. After i run my project, and now when first time unrounded object position is used, huge lag spike happens again. Cpu spikes from 5-10% to 50% and drops frames. In case layout already had object with unrounded position, Start of project lag spike is much bigger. As not knowing for sure if it just happens just for once, and constantly using only round(X/Y) is seems bad. Then even if this bug cant't be fixed it would be good to know why it happens and how to avoid it durning middle of some game project.
,
Dec 12
The NextAction date has arrived: 2018-12-12
,
Dec 31
Any idea what causing this? Or maybe i can do something differently to help? I also can use Construct 2 runtime which code is not minimized, would that help?
,
Jan 8
This issue might be V8 converting Int to float, when float position is used. When V8 optimized values to Int at start. Example has 10176 object background with int positions(rounded). Memory snapshot(see img 1) shows system x 20448 - when that first cpu spikes happens. So it might check all instances twice - and coverting them or something! Also https://www.html5rocks.com/en/tutorials/speed/v8/ talks about v8 optimizing numbers etc and https://v8.dev/blog/elements-kinds Also Construct 3 developer sayd it might be this converting issue that happens first time when float is used, when all object are placed with Int positions. I can use float position with objects when project starts, it does make lag spike go away. But my question is, if game project is build upon V8. And V8 often optimizes and deopimizes, each time dropping frames when doing it. Is there anything that Construct 3 devs can do to smaller the impact? This lag spike happens with position but also with angle, from this it could happen with some internal stuff that i don't have control of. Even if i set angle, position etc to float at start, there still could be something i can't set, which could still cause lag spike You guys have more internal info on this and could help with this issue? not sure how as optimizing is cruzial too. I mean optimizing is good, but frame drops are bad :)
,
Jan 9
The trace seems to blame JS, so over to them. You can get a better trace using chrome://tracing. That will include function names for things happening in the renderer.
,
Today
(22 hours ago)
Jarin@, do you have any insight regarding the questions in #8?
,
Today
(21 hours ago)
As you observed yourself, v8 does have to recompile everything that assumed the integer fields. The only advice we have is to warm-up your functions with the double values first, or at least warm-up every constructor that could construct objects with double values. We are trying to lower the reoptimization cost with concurrent compilation, but you will always pay with a period of time where you run interpreted code after deoptimization. |
||||||
►
Sign in to add a comment |
||||||
Comment 1 by gov...@chromium.org
, Dec 6