Skip to content
This repository has been archived by the owner on Oct 28, 2020. It is now read-only.

Latest commit

 

History

History

noto-sans

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 
 
 

Performance Regression with Noto Sans

Working with Noto Sans fonts on Java 9 takes considerably longer than on Java 8 (at least on Linux). The root seems to be the creation of the T2KFontScaler, which happens deep in the bowels of computing a component's preferred size:

Font2D font = FontUtilities.getFont2D(new Font("Noto Sans CJK JP Black", 0, 12));
Constructor<?> constructor = Class
		.forName("sun.font.T2KFontScaler")
		.getConstructor(Font2D.class, int.class, boolean.class, int.class);
constructor.setAccessible(true);
// for this to not end in a heap dump you need to have Noto Sans CJK JP Black
// installed on your machine
Object scaler = constructor.newInstance(font, 0, true, 18604592);

If this happens in a tight loop (e.g. to display the size of a list of labels, each sporting a different font), the regression is so devastating that the only solution is to exclude these fonts.

The test tries to demonstrate the performance variance by failing the test if it runs longer than half a second but whether that is enough to succeed on Java 8 and fail on Java 9 of course depends on the machine.

(Last checked: 8u131/8u152 and 9.0.1)

Update: Was the regression backported to Java 8? On my machine the test passed with 8u131 but now fails with 8u152.

Two JDK-issues (JDK-8168288 and JDK-8074562) seem related but are supposed to be resolved and available in ea-170 - so how is this still a thing?