From eda39314e74d34ae1b22ef9cd68e8de510303837 Mon Sep 17 00:00:00 2001 From: Anton Leherbauer Date: Mon, 25 Feb 2008 13:22:20 +0000 Subject: [PATCH] Fix bogus performance improvement for path entry comparison --- .../cdt/internal/core/model/APathEntry.java | 19 +++++++------------ 1 file changed, 7 insertions(+), 12 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 fd1cf476c0e..b27c170b63b 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 @@ -96,20 +96,15 @@ public abstract class APathEntry extends PathEntry { return false; } - int i=0; - // performance: iterate to first non-identical path - for (; i < excludeLength; i++) { - if (exclusionPatterns[i] == otherExcludes[i]) { - continue; - } - } Set excludeSet = new HashSet(); Set otherSet = new HashSet(); - for (; i < excludeLength; i++) { - // compare toStrings instead of IPaths - // since IPath.equals is specified to ignore trailing separators - excludeSet.add(exclusionPatterns[i].toString()); - otherSet.add(otherExcludes[i].toString()); + for (int i=0; i < excludeLength; i++) { + if (exclusionPatterns[i] != otherExcludes[i]) { + // compare toStrings instead of IPaths + // since IPath.equals is specified to ignore trailing separators + excludeSet.add(exclusionPatterns[i].toString()); + otherSet.add(otherExcludes[i].toString()); + } } if (!excludeSet.equals(otherSet)) { return false;