Optimize CProjectDescriptionManager.calculateSettingsChanges() because was slow with large numbers of macros.
--- 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;
--- 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<ICLanguageSettingEntry> newEntrySet = new HashSet<ICLanguageSettingEntry>(Arrays.asList(newEntries));
+ Set<ICLanguageSettingEntry> oldEntrySet = new HashSet<ICLanguageSettingEntry>(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;