Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAnton Leherbauer2008-02-01 15:31:10 +0000
committerAnton Leherbauer2008-02-01 15:31:10 +0000
commitf4087a09fc43eaa905e8e47fed752ac2a7faae0d (patch)
tree537296fb8b6f1ab8d107b59f43e194b86a7505b0 /core/org.eclipse.cdt.core/model/org
parente3404b50f07824c49538022149b29908130b153b (diff)
downloadorg.eclipse.cdt-f4087a09fc43eaa905e8e47fed752ac2a7faae0d.tar.gz
org.eclipse.cdt-f4087a09fc43eaa905e8e47fed752ac2a7faae0d.tar.xz
org.eclipse.cdt-f4087a09fc43eaa905e8e47fed752ac2a7faae0d.zip
Performance improvement for path entry comparison
Diffstat (limited to 'core/org.eclipse.cdt.core/model/org')
-rw-r--r--core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/APathEntry.java15
1 files changed, 11 insertions, 4 deletions
diff --git a/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/APathEntry.java b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/APathEntry.java
index f97838d6159..fd1cf476c0e 100644
--- a/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/APathEntry.java
+++ b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/APathEntry.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2007 QNX Software Systems and others.
+ * Copyright (c) 2000, 2008 QNX Software Systems and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -96,9 +96,16 @@ public abstract class APathEntry extends PathEntry {
return false;
}
- Set excludeSet = new HashSet();
- Set otherSet = new HashSet();
- for (int i = 0; i < excludeLength; i++) {
+ int i=0;
+ // performance: iterate to first non-identical path
+ for (; i < excludeLength; i++) {
+ if (exclusionPatterns[i] == otherExcludes[i]) {
+ continue;
+ }
+ }
+ Set<String> excludeSet = new HashSet<String>();
+ Set<String> otherSet = new HashSet<String>();
+ for (; i < excludeLength; i++) {
// compare toStrings instead of IPaths
// since IPath.equals is specified to ignore trailing separators
excludeSet.add(exclusionPatterns[i].toString());

Back to the top