-
Notifications
You must be signed in to change notification settings - Fork 4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Lag problem on Firefox when hands are near proportion #356
Comments
I did a performance test in chrome by spamming a hand back and forth. It often went through the "in proportion" state, but not always. The timing on it shows that 3% (of 5400 ms) was taken up with PDOMUtils.setTextContent. Basically because of these two multilinks: EDIT this one is not contributed, just the one below: ratio-and-proportion/js/discover/view/DiscoverScreenSummaryNode.js Lines 63 to 81 in ffe99a2
Basically every time any of these change at all, we redraw all the innerContent. ParallelDOM.setInnerContent already checks to make sure it isn't setting duplicate content. Thus I fell like we are at a space where we are limited by HTML setting if we wanted to shave down these 130ms at all. I was surprised to not see something about mouse input, especially because I make a fair amount of scrap with Vector2 in RatioHalf.js. Especially with the listener forwarding that using DynamicProperty creates here. Personally, with my chrome 4x throttled, I didn't find performance trouble during this case. @brooklynlash, could you send me some deets about what "Lenovo ThinkPad" is, like processor/year/gpu/cpu stuff? |
I'm going to change my estimate for how much this Multilink in DiscoverScreenSummaryNode is taking. Here is the screenshot where I highlighted the pieces I think are effected by this single multilink: Every time this multilink is called, upwards of three redraws for paragraphs in the screen summary. This not only takes time to call HTMLElement.textContent, but also that cascades to to update layout and style on the HTML style. My current understanding is that "Recalculate Style" is coming from setting that text content. I would like to figure out why this is calling style operations. |
I found that even though we added positionInPDOM, there is still some default style added to elements that aren't posistioned. like so: <input data-trail-id="1127-1128-1290-1297-1292-1402-1298-1299" id="1127-1128-1290-1297-1292-1402-1298-1299" data-focusable="true" class="a11y-pdom-element" type="range" aria-orientation="vertical" aria-valuetext="hands, at challenge ratio" min="0" max="1" step="0.01" aria-valuenow="0.2" style="top: 0px; left: 0px; width: 1px; height: 1px;"> @jessegreenberg , please note this patch, I don't know if it is safe, but I feel like the class Index: js/accessibility/pdom/PDOMPeer.js
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
diff --git a/js/accessibility/pdom/PDOMPeer.js b/js/accessibility/pdom/PDOMPeer.js
--- a/js/accessibility/pdom/PDOMPeer.js (revision e35a38f68d7b793ebf745c2f7aec7ae099fd36fa)
+++ b/js/accessibility/pdom/PDOMPeer.js (date 1614047872282)
@@ -936,12 +936,12 @@
}
else {
- // not positioning, just move off screen
- scratchSiblingBounds.set( PDOMPeer.OFFSCREEN_SIBLING_BOUNDS );
- setClientBounds( this._primarySibling, scratchSiblingBounds );
- if ( this._labelSibling ) {
- setClientBounds( this._labelSibling, scratchSiblingBounds );
- }
+ // // not positioning, just move off screen
+ // scratchSiblingBounds.set( PDOMPeer.OFFSCREEN_SIBLING_BOUNDS );
+ // setClientBounds( this._primarySibling, scratchSiblingBounds );
+ // if ( this._labelSibling ) {
+ // setClientBounds( this._labelSibling, scratchSiblingBounds );
+ // }
}
}
|
@jessegreenberg and I discussed some possible improvements for PDOM performance improvement. All of which seem quite scary to do in RC. As a result we don't want this to block RaP, but we will create an issue in scenery to investigate.
This is all speculation, as Chrome performance tracking was hard to reproduce the above lag with throttling. I will keep working on it. |
I created phetsims/scenery#1163. Unassigning. |
After more investigation, I found that really the solution is to limit the number of times textContent is set to a PDOM element per frame. I made phetsims/scenery#1439 to implement it, but I don't think this issue warrants it at this time. I want to tag @emily-phet in case she would rather implement the PDOM change over in phetsims/scenery#1439 as part of publishing @emily-phet. I recommend deferring this issue personally. Let me know! |
@zepumph Deferring is fine with me. |
Sounds good! Thanks. For next time:
To be clear. I never experienced any performance issues, but I did use the performance tab to see how much computation was going into setting textContent. I believe that they are linked, but have not totally confirmed just yet. |
Test device
Lenovo ThinkPad
Operating System
Win10
Browser
Firefox
Problem description
This is for phetsims/qa#609
Not sure if this is machine-dependent, but there is a performance issue when moving a hand side-to-side when hands are near proportion.
Visuals
Troubleshooting information:
!!!!! DO NOT EDIT !!!!!
Name: Ratio and Proportion
URL: https://phet-dev.colorado.edu/html/ratio-and-proportion/1.0.0-rc.2/phet/ratio-and-proportion_all_phet.html
Version: 1.0.0-rc.2 2021-02-13 05:25:44 UTC
Features missing: touch
Flags: pixelRatioScaling
User Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:85.0) Gecko/20100101 Firefox/85.0
Language: en-US
Window: 1728x858
Pixel Ratio: 2.2222222222222223/1
WebGL: WebGL 1.0
GLSL: WebGL GLSL ES 1.0
Vendor: Mozilla (Mozilla)
Vertex: attribs: 16 varying: 30 uniform: 4095
Texture: size: 16384 imageUnits: 16 (vertex: 16, combined: 32)
Max viewport: 32767x32767
OES_texture_float: true
Dependencies JSON: {}
The text was updated successfully, but these errors were encountered: