[jdk17] Integrated: JDK-8263321: Regression 8% in javadoc-steady in 17-b11

Hannes Wallnöfer hannesw at openjdk.java.net
Tue Jun 15 16:00:03 UTC 2021

On Mon, 14 Jun 2021 13:43:40 GMT, Hannes Wallnöfer <hannesw at openjdk.org> wrote:

> This change fixes a performance regression caused by passing instances of `com.sun.tools.javac.util.Name` to a `html.markup.Text` object, where their content is accessed using`CharSequence` methods which are implemented very inefficiently. 
> Since improving `javac.util.Name` will likely require a bit more work (see JDK-8268622), a safe short term solution for JDK 17 is to make sure instances of `Name` are converted to `String` before invoking said `CharSequence` methods. The main fix is to convert to `String` early in `Entity.escapeHtmlChars(CharSequence)` which is invoked by the `Text` constructor. There are a few more `.toString()` invocations added in places where a `Name` is appended to a `StringBuilder`, although these have less performance impact.

This pull request has now been integrated.

Changeset: 76cad4b1
Author:    Hannes Wallnöfer <hannesw at openjdk.org>
URL:       https://git.openjdk.java.net/jdk17/commit/76cad4b1ae76c6cc854f7a901736bf108639f8f2
Stats:     22 lines in 7 files changed: 2 ins; 0 del; 20 mod

8263321: Regression 8% in javadoc-steady in 17-b11

Reviewed-by: prappo, vromero


PR: https://git.openjdk.java.net/jdk17/pull/42

More information about the compiler-dev mailing list