From f242866c6b4f77ac9164489a685af674fe4d373e Mon Sep 17 00:00:00 2001 From: Anton Leherbauer Date: Fri, 25 May 2007 13:52:38 +0000 Subject: [PATCH] Fix for 189127: Opening project with per file scanner discovery is extremely slow --- .../core/scannerconfig2/PerFileSICollector.java | 13 +++++-------- .../cdt/internal/core/model/APathEntry.java | 15 +++++++++------ 2 files changed, 14 insertions(+), 14 deletions(-) diff --git a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/scannerconfig2/PerFileSICollector.java b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/scannerconfig2/PerFileSICollector.java index 4f05b20f56b..a34ba07e726 100644 --- a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/scannerconfig2/PerFileSICollector.java +++ b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/scannerconfig2/PerFileSICollector.java @@ -8,6 +8,7 @@ * Contributors: * IBM - Initial API and implementation * Markus Schorn (Wind River Systems) + * Anton Leherbauer (Wind River Systems) *******************************************************************************/ package org.eclipse.cdt.make.internal.core.scannerconfig2; @@ -24,13 +25,11 @@ import java.util.SortedSet; import java.util.TreeSet; import java.util.Map.Entry; -import org.eclipse.cdt.core.model.CoreModel; -import org.eclipse.cdt.core.model.IIncludeEntry; import org.eclipse.cdt.make.core.MakeCorePlugin; -import org.eclipse.cdt.make.core.scannerconfig.PathInfo; import org.eclipse.cdt.make.core.scannerconfig.IScannerInfoCollector3; import org.eclipse.cdt.make.core.scannerconfig.IScannerInfoCollectorCleaner; import org.eclipse.cdt.make.core.scannerconfig.InfoContext; +import org.eclipse.cdt.make.core.scannerconfig.PathInfo; import org.eclipse.cdt.make.core.scannerconfig.ScannerInfoTypes; import org.eclipse.cdt.make.core.scannerconfig.IDiscoveredPathManager.IDiscoveredPathInfo; import org.eclipse.cdt.make.core.scannerconfig.IDiscoveredPathManager.IDiscoveredScannerInfoSerializable; @@ -41,14 +40,10 @@ import org.eclipse.cdt.make.internal.core.scannerconfig.DiscoveredScannerInfoSto import org.eclipse.cdt.make.internal.core.scannerconfig.ScannerConfigUtil; import org.eclipse.cdt.make.internal.core.scannerconfig.util.CCommandDSC; import org.eclipse.cdt.make.internal.core.scannerconfig.util.CygpathTranslator; -import org.eclipse.cdt.make.internal.core.scannerconfig.util.KVStringPair; import org.eclipse.cdt.make.internal.core.scannerconfig.util.TraceUtil; -import org.eclipse.core.resources.IContainer; import org.eclipse.core.resources.IFile; import org.eclipse.core.resources.IProject; import org.eclipse.core.resources.IResource; -import org.eclipse.core.resources.IWorkspaceRoot; -import org.eclipse.core.resources.ResourcesPlugin; import org.eclipse.core.runtime.CoreException; import org.eclipse.core.runtime.IPath; import org.eclipse.core.runtime.IProgressMonitor; @@ -844,7 +839,9 @@ public class PerFileSICollector implements IScannerInfoCollector3, IScannerInfoC } for (Iterator j = discovered.iterator(); j.hasNext(); ) { String include = (String) j.next(); - include = CCommandDSC.makeRelative(project, new Path(include)).toPortableString(); + // the following line degrades perfomance + // see https://bugs.eclipse.org/bugs/show_bug.cgi?id=189127 +// include = CCommandDSC.makeRelative(project, new Path(include)).toPortableString(); if (!allIncludes.contains(include)) { allIncludes.add(include); } 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 8ecc30da194..a22fc6f8737 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, 2006 QNX Software Systems and others. + * Copyright (c) 2000, 2007 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 @@ -7,6 +7,7 @@ * * Contributors: * QNX Software Systems - Initial API and implementation + * Anton Leherbauer (Wind River Systems) *******************************************************************************/ package org.eclipse.cdt.internal.core.model; @@ -91,11 +92,13 @@ public abstract class APathEntry extends PathEntry { return false; } for (int i = 0; i < excludeLength; i++) { - // compare toStrings instead of IPaths - // since IPath.equals is specified to ignore trailing separators - String myPattern = exclusionPatterns[i].toString(); - if (!myPattern.equals(otherExcludes[i].toString())) { - return false; + if (exclusionPatterns[i] != otherExcludes[i]) { + // compare toStrings instead of IPaths + // since IPath.equals is specified to ignore trailing separators + String myPattern = exclusionPatterns[i].toString(); + if (!myPattern.equals(otherExcludes[i].toString())) { + return false; + } } } }