Community
Participate
Working Groups
If you use GC to measure the text dimension (usually in computeSize), font property is rendered multiple times to the client.
Created attachment 176962 [details] Test case This issue has been observed in Riena, running on top of RAP. Riena uses a pattern like: ---- GC gc = new GC( this ); gc.setFont( font ); FontMetrics metrics = gc.getFontMetrics(); .... do some calculations .... gc.dispose(); ---- in their SWT computeSize or similar methods, which leads to sequence of equals SetFont operations in GCAdapter#gcOperations list. As a result, javascript code gc.setProperty( "font", "..." ) has been rendered multiple times. In Riena SWT example application I count 290 usless set font renderings in every request/response, which increases the size of rendered javascript a lot.
Created attachment 176963 [details] Patch to solve the problem Add new SetFont operation to the list with gc operations (GCAdapter#addOperation) only if the font of last SetFont operation differ.
Apply patch to CVS HEAD. As a result of the patch, the number of gc.setProperty( "font", "..." ) renderings in Riena SWT Example App has been reduced from 290 to 12 and the size of request/response data from 40k to 10k. This reduced the browser CPU usage 3 times as well.
Cool! Thanks!
Fixed in a different way with bug 323116.