[JBoss JIRA] (ERT-762) [GTK] Performance of TextLayout.getBounds() is very bad for long text [EBZ#551588]
by Eric Williams (Jira)
[ https://issues.jboss.org/browse/ERT-762?page=com.atlassian.jira.plugin.sy... ]
Eric Williams reassigned ERT-762:
---------------------------------
Sprint: devex #173 Oct 2019
Assignee: Eric Williams
> [GTK] Performance of TextLayout.getBounds() is very bad for long text [EBZ#551588]
> ----------------------------------------------------------------------------------
>
> Key: ERT-762
> URL: https://issues.jboss.org/browse/ERT-762
> Project: Eclipse Release Train
> Issue Type: Task
> Components: Platform
> Reporter: Friendly Jira Robot
> Assignee: Eric Williams
> Priority: Major
> Labels: 4.14_M1, SWT, bzira
>
> I've noticed a slow performance of TextLayout.getBounds() method on Linux. The profiler shows an excessive amount of calls to OS.pango_layout_get_line_count(layout) method. Looking through the code I'm noticing that this is due to the bad design in TextLayout class, as it repeats calls to same OS methods repeatedly in a loop.
> The TextLayout.getBounds() method looks like this:
> public Rectangle getBounds() {
> checkLayout();
> Rectangle bounds = DPIUtil.autoScaleDown(getDevice(), getBoundsInPixels());
> int lineCount = OS.pango_layout_get_line_count(layout);
> int totalLineheight = getScaledVerticalIndent();
> for (int i = 0; i < lineCount; i++) {
> totalLineheight += this.getLineBounds(i).height + OS.PANGO_PIXELS(OS.pango_layout_get_spacing(layout));
> }
> bounds.height = totalLineheight;
> return bounds;
> }
> Here I believe the result of OS.pango_layout_get_spacing(layout) could be cached. Further down the line this calls TextLayout.getLineBoundsInPixels method.
> Rectangle getLineBoundsInPixels(int lineIndex) {
> computeRuns();
> int lineCount = OS.pango_layout_get_line_count(layout);
> if (!(0 <= lineIndex && lineIndex < lineCount)) SWT.error(SWT.ERROR_INVALID_RANGE);
> long iter = OS.pango_layout_get_iter(layout);
> if (iter == 0) SWT.error(SWT.ERROR_NO_HANDLES);
> for (int i = 0; i < lineIndex; i++) OS.pango_layout_iter_next_line(iter);
> PangoRectangle rect = new PangoRectangle();
> OS.pango_layout_iter_get_line_extents(iter, null, rect);
> OS.pango_layout_iter_free(iter);
> int x = OS.PANGO_PIXELS(rect.x);
> int y = OS.PANGO_PIXELS(rect.y);
> int width = OS.PANGO_PIXELS(rect.width);
> int height = OS.PANGO_PIXELS(rect.height);
> if (ascentInPoints != -1 && descentInPoints != -1) {
> height = Math.max (height, DPIUtil.autoScaleUp(getDevice(), ascentInPoints + descentInPoints));
> }
> x += Math.min (indent, wrapIndent);
> return new Rectangle(x, y, width, height);
> }
> This method repeats the call to OS.pango_layout_get_line_count. Also things like computeRuns() and OS.pango_layout_get_iter(layout) could be done once per TextLayout.getBounds call. Done in a loop this quickly escalates to slow performance.
> I believe TextLayout.getBounds() should be refactored to minimize repeated calls and reuse results.
--
This message was sent by Atlassian Jira
(v7.13.8#713008)
6 years, 1 month
[JBoss JIRA] (ERT-762) [GTK] Performance of TextLayout.getBounds() is very bad for long text [EBZ#551588]
by Friendly Jira Robot (Jira)
Friendly Jira Robot created ERT-762:
---------------------------------------
Summary: [GTK] Performance of TextLayout.getBounds() is very bad for long text [EBZ#551588]
Key: ERT-762
URL: https://issues.jboss.org/browse/ERT-762
Project: Eclipse Release Train
Issue Type: Task
Components: Platform
Reporter: Friendly Jira Robot
I've noticed a slow performance of TextLayout.getBounds() method on Linux. The profiler shows an excessive amount of calls to OS.pango_layout_get_line_count(layout) method. Looking through the code I'm noticing that this is due to the bad design in TextLayout class, as it repeats calls to same OS methods repeatedly in a loop.
The TextLayout.getBounds() method looks like this:
public Rectangle getBounds() {
checkLayout();
Rectangle bounds = DPIUtil.autoScaleDown(getDevice(), getBoundsInPixels());
int lineCount = OS.pango_layout_get_line_count(layout);
int totalLineheight = getScaledVerticalIndent();
for (int i = 0; i < lineCount; i++) {
totalLineheight += this.getLineBounds(i).height + OS.PANGO_PIXELS(OS.pango_layout_get_spacing(layout));
}
bounds.height = totalLineheight;
return bounds;
}
Here I believe the result of OS.pango_layout_get_spacing(layout) could be cached. Further down the line this calls TextLayout.getLineBoundsInPixels method.
Rectangle getLineBoundsInPixels(int lineIndex) {
computeRuns();
int lineCount = OS.pango_layout_get_line_count(layout);
if (!(0 <= lineIndex && lineIndex < lineCount)) SWT.error(SWT.ERROR_INVALID_RANGE);
long iter = OS.pango_layout_get_iter(layout);
if (iter == 0) SWT.error(SWT.ERROR_NO_HANDLES);
for (int i = 0; i < lineIndex; i++) OS.pango_layout_iter_next_line(iter);
PangoRectangle rect = new PangoRectangle();
OS.pango_layout_iter_get_line_extents(iter, null, rect);
OS.pango_layout_iter_free(iter);
int x = OS.PANGO_PIXELS(rect.x);
int y = OS.PANGO_PIXELS(rect.y);
int width = OS.PANGO_PIXELS(rect.width);
int height = OS.PANGO_PIXELS(rect.height);
if (ascentInPoints != -1 && descentInPoints != -1) {
height = Math.max (height, DPIUtil.autoScaleUp(getDevice(), ascentInPoints + descentInPoints));
}
x += Math.min (indent, wrapIndent);
return new Rectangle(x, y, width, height);
}
This method repeats the call to OS.pango_layout_get_line_count. Also things like computeRuns() and OS.pango_layout_get_iter(layout) could be done once per TextLayout.getBounds call. Done in a loop this quickly escalates to slow performance.
I believe TextLayout.getBounds() should be refactored to minimize repeated calls and reuse results.
--
This message was sent by Atlassian Jira
(v7.13.8#713008)
6 years, 1 month
[JBoss JIRA] (JBIDE-26879) Configuring CRC Openshift Connection has encountered a problem
by Ondrej Dockal (Jira)
[ https://issues.jboss.org/browse/JBIDE-26879?page=com.atlassian.jira.plugi... ]
Ondrej Dockal commented on JBIDE-26879:
---------------------------------------
[~adietish][~kumarpraveen] I have got the same issue with OS 4.2 online we talked today on the call. So the issue originated there, whether it is a bug or a feature...
> Configuring CRC Openshift Connection has encountered a problem
> --------------------------------------------------------------
>
> Key: JBIDE-26879
> URL: https://issues.jboss.org/browse/JBIDE-26879
> Project: Tools (JBoss Tools)
> Issue Type: Bug
> Components: cdk, openshift
> Affects Versions: 4.13.0.Final
> Environment: Fedora 29
> CR Studio 12.13.0.GA-v20190929-1916-B5040
> CRC version: 1.0.0-rc.0+34371d3
> Reporter: Ondrej Dockal
> Assignee: André Dietisheim
> Priority: Blocker
> Fix For: 4.13.0.Final
>
> Attachments: screenshot-1.png
>
>
> Cannot create Project under CRC Openshift connection when using CRC.
> I get an error dialog when "Configuring CRC Openshift Connection"
> Dialog has appeared just after accepting the SSL certificate dialog confirmation during CRC start up.
> {code}
> An internal error occurred during: "Configuring CRC Openshift Connection...".
> forbidden: User "system:anonymous" cannot get path "/apis" forbidden: User "system:anonymous" cannot get path "/apis"
> {code}
> Error details:
> {code}
> null
> org.eclipse.core.jobs
> Error
> Mon Sep 30 13:01:32 CEST 2019
> An internal error occurred during: "Configuring CRC Openshift Connection...".
> com.openshift.restclient.authorization.ResourceForbiddenException: forbidden: User "system:anonymous" cannot get path "/apis" forbidden: User "system:anonymous" cannot get path "/apis"
> at com.openshift.internal.restclient.okhttp.ResponseCodeInterceptor.createOpenShiftException(ResponseCodeInterceptor.java:111)
> at com.openshift.internal.restclient.okhttp.ResponseCodeInterceptor.intercept(ResponseCodeInterceptor.java:66)
> at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.kt:112)
> at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.kt:87)
> at okhttp3.RealCall.getResponseWithInterceptorChain(RealCall.kt:184)
> at okhttp3.RealCall.execute(RealCall.kt:66)
> at com.openshift.internal.restclient.ApiTypeMapper.request(ApiTypeMapper.java:265)
> at com.openshift.internal.restclient.ApiTypeMapper.readEndpoint(ApiTypeMapper.java:257)
> at com.openshift.internal.restclient.ApiTypeMapper.getApiGroups(ApiTypeMapper.java:220)
> at com.openshift.internal.restclient.ApiTypeMapper.init(ApiTypeMapper.java:155)
> at com.openshift.internal.restclient.ApiTypeMapper.isSupported(ApiTypeMapper.java:83)
> at com.openshift.internal.restclient.URLBuilder.buildWithNamespaceInPath(URLBuilder.java:148)
> at com.openshift.internal.restclient.URLBuilder.build(URLBuilder.java:135)
> at com.openshift.internal.restclient.DefaultClient.execute(DefaultClient.java:301)
> at com.openshift.internal.restclient.DefaultClient.execute(DefaultClient.java:275)
> at com.openshift.internal.restclient.DefaultClient.execute(DefaultClient.java:243)
> at com.openshift.internal.restclient.DefaultClient.execute(DefaultClient.java:226)
> at com.openshift.internal.restclient.DefaultClient.get(DefaultClient.java:423)
> at com.openshift.internal.restclient.authorization.AuthorizationContext.isAuthorized(AuthorizationContext.java:63)
> at org.jboss.tools.openshift.core.connection.Connection.authorize(Connection.java:237)
> at org.jboss.tools.openshift.core.connection.Connection.connect(Connection.java:226)
> at org.jboss.tools.openshift.internal.crc.server.core.listeners.ConfigureCRCFrameworksListener.configureOpenshift(ConfigureCRCFrameworksListener.java:102)
> at org.jboss.tools.openshift.internal.crc.server.core.listeners.ConfigureCRCFrameworksListener.configureFrameworks(ConfigureCRCFrameworksListener.java:73)
> at org.jboss.tools.openshift.internal.crc.server.core.listeners.ConfigureCRCFrameworksListener$1.run(ConfigureCRCFrameworksListener.java:66)
> at org.eclipse.core.internal.jobs.Worker.run(Worker.java:63)
> {code}
--
This message was sent by Atlassian Jira
(v7.13.8#713008)
6 years, 1 month
[JBoss JIRA] (JBIDE-26879) Configuring CRC Openshift Connection has encountered a problem
by André Dietisheim (Jira)
[ https://issues.jboss.org/browse/JBIDE-26879?page=com.atlassian.jira.plugi... ]
André Dietisheim commented on JBIDE-26879:
------------------------------------------
I can replicate this unfortunately:
!screenshot-1.png!
{code}
com.openshift.restclient.authorization.ResourceForbiddenException: forbidden: User "system:anonymous" cannot get path "/apis" forbidden: User "system:anonymous" cannot get path "/apis"
at com.openshift.internal.restclient.okhttp.ResponseCodeInterceptor.createOpenShiftException(ResponseCodeInterceptor.java:111)
at com.openshift.internal.restclient.okhttp.ResponseCodeInterceptor.intercept(ResponseCodeInterceptor.java:66)
at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.kt:112)
at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.kt:87)
at okhttp3.RealCall.getResponseWithInterceptorChain(RealCall.kt:184)
at okhttp3.RealCall.execute(RealCall.kt:66)
at com.openshift.internal.restclient.ApiTypeMapper.request(ApiTypeMapper.java:265)
at com.openshift.internal.restclient.ApiTypeMapper.readEndpoint(ApiTypeMapper.java:257)
at com.openshift.internal.restclient.ApiTypeMapper.getApiGroups(ApiTypeMapper.java:220)
at com.openshift.internal.restclient.ApiTypeMapper.init(ApiTypeMapper.java:155)
at com.openshift.internal.restclient.ApiTypeMapper.isSupported(ApiTypeMapper.java:84)
at com.openshift.internal.restclient.URLBuilder.buildWithNamespaceInPath(URLBuilder.java:148)
at com.openshift.internal.restclient.URLBuilder.build(URLBuilder.java:135)
at com.openshift.internal.restclient.DefaultClient.execute(DefaultClient.java:301)
at com.openshift.internal.restclient.DefaultClient.execute(DefaultClient.java:275)
at com.openshift.internal.restclient.DefaultClient.execute(DefaultClient.java:243)
at com.openshift.internal.restclient.DefaultClient.execute(DefaultClient.java:226)
at com.openshift.internal.restclient.DefaultClient.get(DefaultClient.java:423)
at com.openshift.internal.restclient.authorization.AuthorizationContext.isAuthorized(AuthorizationContext.java:63)
at org.jboss.tools.openshift.core.connection.Connection.authorize(Connection.java:239)
at org.jboss.tools.openshift.core.connection.Connection.connect(Connection.java:228)
at org.jboss.tools.openshift.internal.crc.server.core.listeners.ConfigureCRCFrameworksListener.configureOpenshift(ConfigureCRCFrameworksListener.java:107)
at org.jboss.tools.openshift.internal.crc.server.core.listeners.ConfigureCRCFrameworksListener.configureFrameworks(ConfigureCRCFrameworksListener.java:75)
at org.jboss.tools.openshift.internal.crc.server.core.listeners.ConfigureCRCFrameworksListener$1.run(ConfigureCRCFrameworksListener.java:68)
at org.eclipse.core.internal.jobs.Worker.run(Worker.java:63)
{code}
> Configuring CRC Openshift Connection has encountered a problem
> --------------------------------------------------------------
>
> Key: JBIDE-26879
> URL: https://issues.jboss.org/browse/JBIDE-26879
> Project: Tools (JBoss Tools)
> Issue Type: Bug
> Components: cdk, openshift
> Affects Versions: 4.13.0.Final
> Environment: Fedora 29
> CR Studio 12.13.0.GA-v20190929-1916-B5040
> CRC version: 1.0.0-rc.0+34371d3
> Reporter: Ondrej Dockal
> Assignee: André Dietisheim
> Priority: Blocker
> Fix For: 4.13.0.Final
>
> Attachments: screenshot-1.png
>
>
> Cannot create Project under CRC Openshift connection when using CRC.
> I get an error dialog when "Configuring CRC Openshift Connection"
> Dialog has appeared just after accepting the SSL certificate dialog confirmation during CRC start up.
> {code}
> An internal error occurred during: "Configuring CRC Openshift Connection...".
> forbidden: User "system:anonymous" cannot get path "/apis" forbidden: User "system:anonymous" cannot get path "/apis"
> {code}
> Error details:
> {code}
> null
> org.eclipse.core.jobs
> Error
> Mon Sep 30 13:01:32 CEST 2019
> An internal error occurred during: "Configuring CRC Openshift Connection...".
> com.openshift.restclient.authorization.ResourceForbiddenException: forbidden: User "system:anonymous" cannot get path "/apis" forbidden: User "system:anonymous" cannot get path "/apis"
> at com.openshift.internal.restclient.okhttp.ResponseCodeInterceptor.createOpenShiftException(ResponseCodeInterceptor.java:111)
> at com.openshift.internal.restclient.okhttp.ResponseCodeInterceptor.intercept(ResponseCodeInterceptor.java:66)
> at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.kt:112)
> at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.kt:87)
> at okhttp3.RealCall.getResponseWithInterceptorChain(RealCall.kt:184)
> at okhttp3.RealCall.execute(RealCall.kt:66)
> at com.openshift.internal.restclient.ApiTypeMapper.request(ApiTypeMapper.java:265)
> at com.openshift.internal.restclient.ApiTypeMapper.readEndpoint(ApiTypeMapper.java:257)
> at com.openshift.internal.restclient.ApiTypeMapper.getApiGroups(ApiTypeMapper.java:220)
> at com.openshift.internal.restclient.ApiTypeMapper.init(ApiTypeMapper.java:155)
> at com.openshift.internal.restclient.ApiTypeMapper.isSupported(ApiTypeMapper.java:83)
> at com.openshift.internal.restclient.URLBuilder.buildWithNamespaceInPath(URLBuilder.java:148)
> at com.openshift.internal.restclient.URLBuilder.build(URLBuilder.java:135)
> at com.openshift.internal.restclient.DefaultClient.execute(DefaultClient.java:301)
> at com.openshift.internal.restclient.DefaultClient.execute(DefaultClient.java:275)
> at com.openshift.internal.restclient.DefaultClient.execute(DefaultClient.java:243)
> at com.openshift.internal.restclient.DefaultClient.execute(DefaultClient.java:226)
> at com.openshift.internal.restclient.DefaultClient.get(DefaultClient.java:423)
> at com.openshift.internal.restclient.authorization.AuthorizationContext.isAuthorized(AuthorizationContext.java:63)
> at org.jboss.tools.openshift.core.connection.Connection.authorize(Connection.java:237)
> at org.jboss.tools.openshift.core.connection.Connection.connect(Connection.java:226)
> at org.jboss.tools.openshift.internal.crc.server.core.listeners.ConfigureCRCFrameworksListener.configureOpenshift(ConfigureCRCFrameworksListener.java:102)
> at org.jboss.tools.openshift.internal.crc.server.core.listeners.ConfigureCRCFrameworksListener.configureFrameworks(ConfigureCRCFrameworksListener.java:73)
> at org.jboss.tools.openshift.internal.crc.server.core.listeners.ConfigureCRCFrameworksListener$1.run(ConfigureCRCFrameworksListener.java:66)
> at org.eclipse.core.internal.jobs.Worker.run(Worker.java:63)
> {code}
--
This message was sent by Atlassian Jira
(v7.13.8#713008)
6 years, 1 month
[JBoss JIRA] (JBIDE-26879) Configuring CRC Openshift Connection has encountered a problem
by André Dietisheim (Jira)
[ https://issues.jboss.org/browse/JBIDE-26879?page=com.atlassian.jira.plugi... ]
André Dietisheim updated JBIDE-26879:
-------------------------------------
Attachment: screenshot-1.png
> Configuring CRC Openshift Connection has encountered a problem
> --------------------------------------------------------------
>
> Key: JBIDE-26879
> URL: https://issues.jboss.org/browse/JBIDE-26879
> Project: Tools (JBoss Tools)
> Issue Type: Bug
> Components: cdk, openshift
> Affects Versions: 4.13.0.Final
> Environment: Fedora 29
> CR Studio 12.13.0.GA-v20190929-1916-B5040
> CRC version: 1.0.0-rc.0+34371d3
> Reporter: Ondrej Dockal
> Assignee: André Dietisheim
> Priority: Blocker
> Fix For: 4.13.0.Final
>
> Attachments: screenshot-1.png
>
>
> Cannot create Project under CRC Openshift connection when using CRC.
> I get an error dialog when "Configuring CRC Openshift Connection"
> Dialog has appeared just after accepting the SSL certificate dialog confirmation during CRC start up.
> {code}
> An internal error occurred during: "Configuring CRC Openshift Connection...".
> forbidden: User "system:anonymous" cannot get path "/apis" forbidden: User "system:anonymous" cannot get path "/apis"
> {code}
> Error details:
> {code}
> null
> org.eclipse.core.jobs
> Error
> Mon Sep 30 13:01:32 CEST 2019
> An internal error occurred during: "Configuring CRC Openshift Connection...".
> com.openshift.restclient.authorization.ResourceForbiddenException: forbidden: User "system:anonymous" cannot get path "/apis" forbidden: User "system:anonymous" cannot get path "/apis"
> at com.openshift.internal.restclient.okhttp.ResponseCodeInterceptor.createOpenShiftException(ResponseCodeInterceptor.java:111)
> at com.openshift.internal.restclient.okhttp.ResponseCodeInterceptor.intercept(ResponseCodeInterceptor.java:66)
> at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.kt:112)
> at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.kt:87)
> at okhttp3.RealCall.getResponseWithInterceptorChain(RealCall.kt:184)
> at okhttp3.RealCall.execute(RealCall.kt:66)
> at com.openshift.internal.restclient.ApiTypeMapper.request(ApiTypeMapper.java:265)
> at com.openshift.internal.restclient.ApiTypeMapper.readEndpoint(ApiTypeMapper.java:257)
> at com.openshift.internal.restclient.ApiTypeMapper.getApiGroups(ApiTypeMapper.java:220)
> at com.openshift.internal.restclient.ApiTypeMapper.init(ApiTypeMapper.java:155)
> at com.openshift.internal.restclient.ApiTypeMapper.isSupported(ApiTypeMapper.java:83)
> at com.openshift.internal.restclient.URLBuilder.buildWithNamespaceInPath(URLBuilder.java:148)
> at com.openshift.internal.restclient.URLBuilder.build(URLBuilder.java:135)
> at com.openshift.internal.restclient.DefaultClient.execute(DefaultClient.java:301)
> at com.openshift.internal.restclient.DefaultClient.execute(DefaultClient.java:275)
> at com.openshift.internal.restclient.DefaultClient.execute(DefaultClient.java:243)
> at com.openshift.internal.restclient.DefaultClient.execute(DefaultClient.java:226)
> at com.openshift.internal.restclient.DefaultClient.get(DefaultClient.java:423)
> at com.openshift.internal.restclient.authorization.AuthorizationContext.isAuthorized(AuthorizationContext.java:63)
> at org.jboss.tools.openshift.core.connection.Connection.authorize(Connection.java:237)
> at org.jboss.tools.openshift.core.connection.Connection.connect(Connection.java:226)
> at org.jboss.tools.openshift.internal.crc.server.core.listeners.ConfigureCRCFrameworksListener.configureOpenshift(ConfigureCRCFrameworksListener.java:102)
> at org.jboss.tools.openshift.internal.crc.server.core.listeners.ConfigureCRCFrameworksListener.configureFrameworks(ConfigureCRCFrameworksListener.java:73)
> at org.jboss.tools.openshift.internal.crc.server.core.listeners.ConfigureCRCFrameworksListener$1.run(ConfigureCRCFrameworksListener.java:66)
> at org.eclipse.core.internal.jobs.Worker.run(Worker.java:63)
> {code}
--
This message was sent by Atlassian Jira
(v7.13.8#713008)
6 years, 1 month