# HG changeset patch # User dadubrow # Date 1245183207 18000 # Node ID 71d9077848c484ea1206c0eb063dfe3f25e2a607 # Parent 550d1ce4a53b9c271f153c1e28b10e4f3ce43f44 Optimize CProjectDescriptionManager.calculateSettingsChanges() because was slow with large numbers of macros. diff -r 550d1ce4a53b -r 71d9077848c4 cdt/cdt_5_0_x/org.eclipse.cdt.core/model/org/eclipse/cdt/core/settings/model/CLibraryFileEntry.java --- a/cdt/cdt_5_0_x/org.eclipse.cdt.core/model/org/eclipse/cdt/core/settings/model/CLibraryFileEntry.java Tue Jun 16 13:57:17 2009 -0500 +++ b/cdt/cdt_5_0_x/org.eclipse.cdt.core/model/org/eclipse/cdt/core/settings/model/CLibraryFileEntry.java Tue Jun 16 15:13:27 2009 -0500 @@ -104,6 +104,18 @@ } @Override + public int hashCode() { + final int prime = 31; + int result = super.hashCode(); + result = prime * result + ((fSourceAttachmentPath == null) ? 0 : fSourceAttachmentPath.hashCode()); + result = prime * result + + ((fSourceAttachmentPrefixMapping == null) ? 0 : fSourceAttachmentPrefixMapping.hashCode()); + result = prime * result + + ((fSourceAttachmentRootPath == null) ? 0 : fSourceAttachmentRootPath.hashCode()); + return result; + } + + @Override public boolean equalsByContents(ICSettingEntry entry) { if(entry == this) return true; diff -r 550d1ce4a53b -r 71d9077848c4 cdt/cdt_5_0_x/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/settings/model/CProjectDescriptionManager.java --- a/cdt/cdt_5_0_x/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/settings/model/CProjectDescriptionManager.java Tue Jun 16 13:57:17 2009 -0500 +++ b/cdt/cdt_5_0_x/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/settings/model/CProjectDescriptionManager.java Tue Jun 16 15:13:27 2009 -0500 @@ -2530,14 +2530,15 @@ newEntries = EMPTY_LANGUAGE_SETTINGS_ENTRIES_ARRAY; } + Set newEntrySet = new HashSet(Arrays.asList(newEntries)); + Set oldEntrySet = new HashSet(Arrays.asList(oldEntries)); + // Check the removed entries. - for (int i = 0; i < oldEntries.length; i++) { + for (ICLanguageSettingEntry oldEntry : oldEntries) { boolean found = false; - for (int j = 0; j < newEntries.length; j++) { - if (oldEntries[i].equals(newEntries[j])) { - found = true; - break; - } + if (newEntrySet.contains(oldEntry)) { + found = true; + break; } if(!found){ result[1] = true; @@ -2546,13 +2547,11 @@ } // Check the new entries. - for (int i = 0; i < newEntries.length; i++) { + for (ICLanguageSettingEntry newEntry : newEntries) { boolean found = false; - for (int j = 0; j < oldEntries.length; j++) { - if (newEntries[i].equals(oldEntries[j])) { - found = true; - break; - } + if (oldEntrySet.contains(newEntry)) { + found = true; + break; } if(!found){ result[0] = true;