mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
avoid easy garbage
java.util.ArrayList$Itr: 1,720,417,512 (1%) bytes in 71,684,063 (2%) objects (avg size 24 bytes) java.util.ArrayList.iterator: 1,720,392,864 (99%) bytes in 71,683,036 (99%) objects com.intellij.openapi.projectRoots.impl.ProjectJdkTableImpl.findJdk: 938,831,640 (54%) bytes in 39,117,985 (54%) objects com.intellij.openapi.editor.impl.ComplementaryFontsRegistry.getFontAbleToDisplay: 218,420,520 (12%) bytes in 9,100,855 (12%) objects
This commit is contained in:
+3
-1
@@ -109,7 +109,9 @@ public class ProjectJdkTableImpl extends ProjectJdkTable implements PersistentSt
|
||||
@Override
|
||||
@Nullable
|
||||
public Sdk findJdk(String name) {
|
||||
for (Sdk jdk : mySdks) {
|
||||
//noinspection ForLoopReplaceableByForEach
|
||||
for (int i = 0, len = mySdks.size(); i < len; ++i) { // avoid foreach, it instantiates ArrayList$Itr, this traversal happens very often
|
||||
final Sdk jdk = mySdks.get(i);
|
||||
if (Comparing.strEqual(name, jdk.getName())) {
|
||||
return jdk;
|
||||
}
|
||||
|
||||
+2
-1
@@ -148,7 +148,8 @@ public class ComplementaryFontsRegistry {
|
||||
boolean tryDefaultFont = true;
|
||||
List<String> fontFamilies = preferences.getEffectiveFontFamilies();
|
||||
FontInfo result;
|
||||
for (String fontFamily : fontFamilies) {
|
||||
for (int i = 0, len = fontFamilies.size(); i < len; ++i) {
|
||||
final String fontFamily = fontFamilies.get(i);
|
||||
result = doGetFontAbleToDisplay(c, preferences.getSize(fontFamily), style, fontFamily);
|
||||
if (result != null) {
|
||||
return result;
|
||||
|
||||
Reference in New Issue
Block a user