Skip to content

Commit

Permalink
FlatLaf: use larger initial capacity for UI defaults table to avoid r…
Browse files Browse the repository at this point in the history
…esizing hash table and to save some memory
  • Loading branch information
DevCharly committed Aug 12, 2021
1 parent 751919e commit 7bc9be6
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion flatlaf-core/src/main/java/com/formdev/flatlaf/FlatLaf.java
Original file line number Diff line number Diff line change
Expand Up @@ -354,7 +354,14 @@ private void initializeAqua() {

@Override
public UIDefaults getDefaults() {
UIDefaults defaults = super.getDefaults();
// use larger initial capacity to avoid resizing UI defaults hash table
// (from 610 to 1221 to 2443 entries) and to save some memory
UIDefaults defaults = new UIDefaults( 1500, 0.75f );

// initialize basic defaults (see super.getDefaults())
initClassDefaults( defaults );
initSystemColorDefaults( defaults );
initComponentDefaults( defaults );

// add flag that indicates whether the LaF is light or dark
// (can be queried without using FlatLaf API)
Expand Down

0 comments on commit 7bc9be6

Please sign in to comment.