JDK-8195089 : Swing classes are extremely slow when displaying Hebrew text (and possibly other RTL languages)
  • Type: Bug
  • Component: client-libs
  • Sub-Component: javax.swing
  • Affected Version: 8,9,10
  • Priority: P3
  • Status: Open
  • Resolution: Unresolved
  • OS: windows_10
  • CPU: x86_64
  • Submitted: 2018-01-09
  • Updated: 2021-12-18
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
Other
tbdUnresolved
Description
FULL PRODUCT VERSION :
java version "1.8.0_151"
Java(TM) SE Runtime Environment (build 1.8.0_151-b12)
Java HotSpot(TM) 64-Bit Server VM (build 25.151-b12, mixed mode)

ADDITIONAL OS VERSION INFORMATION :
Microsoft Windows [Version 10.0.16299.98]

A DESCRIPTION OF THE PROBLEM :
All Swing UI components are extremely slow when displaying Hebrew text. Whether it's JTable, JTextArea, JTextPanel, etc., when displaying reasonably sized paragraph of Hebrew text (even at 100-200 words) is very slow, in the order of seconds, and it keeps being slower and slower as the amount of text increases. 

STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
String hebrewText = // some Hebrew text here, even a paragraph of about 100 words is sufficient.

JTextArea x = new JTextArea();
x.setText(hebrewText);

Possibly do something to make this show up as well, measure the time and you'll see that it is extremely slow compared to displaying text in English.

EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
The performance for displaying Hebrew texts should be better
ACTUAL -
The performance is horrible. This is observed across multiple machines running various versions of Windows (10, 8, 7).

REPRODUCIBILITY :
This bug can be reproduced always.

---------- BEGIN SOURCE ----------
String hebrewText = // some Hebrew text here, even a paragraph of about 100 words is sufficient.

JTextArea x = new JTextArea();
x.setText(hebrewText);

Possibly do something to make this show up as well, measure the time and you'll see that it is extremely slow compared to displaying text in English.
---------- END SOURCE ----------


Comments
Checked again based upon additional information provided by the submitter to increase the length of text in the test case and confirm the issue as reported. ============================================================================================================= If the text is 10 times as long, the Hebrew test takes 800ms, while the English one still takes 100ms. If it's made the 20 times as long, the Hebrew test takes 1500ms(!), and the English one again still takes 100ms. We can see that as there is an increase in the amount of text, the Hebrew performance gets worse and worse, while the English performance stays more or less the same. =============================================================================================================== Verfied with the modified test case and confirmed the variation in time taken. Output with JDK 8u151 ======================= >java -version java version "1.8.0_151" Java(TM) SE Runtime Environment (build 1.8.0_151-b12) Java HotSpot(TM) 64-Bit Server VM (build 25.151-b12, mixed mode) >javac EnglishTest.java >java EnglishTest Time=119ms >javac -encoding "UTF-8" HebrewTest.java >java HebrewTest Time=1387ms ======================== Results: ======== 8: Fail 8u151: Fail 9.0.4: Fail 10 ea b39: Fail
22-01-2018

Reported with JDK 8u151 Windows 10 As per description all Swing UI components are slow to display Hebrew text when compared to display with english text. Checked this with: JDK 8u151/9.0.1/10 Windows 10 Created simple test to display Hebrew and English text in JTextArea, see attached (HebrewTest.java and English.java) but couldn't reproduce the issue as reported. Both Hebrew and English text strings are displayed fine and in equal interval of time. Written back to the submitter with results and to reconfirm the status at his end. Results: 8u151: OK 9.0.1: OK 10 ea b38: OK
15-01-2018