Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[cdt-dev] Performance issue with IReadOnlyPDOMProvider

Hi everyone,

  I am trying to export my indexer PDOM file and to reimport it to a different project.
  I have used the extension point : org.eclipse.cdt.core.CIndex and provided an ExportProjectProvider and a ReadOnlyPDOMProvider
 
  My issue is that now,
  The export of the project takes : 213 sec
  The normal indexing without cached pdom file takes 208 sec
  When loading the PDOM file I constructed it takes : 412 sec

  You will find below the IIndexLocationConverter code.

  Do you think it is due to my IIndexLocationConverter that needs optimizing ? Or am I using the wrong mechanism to cache my index ?

Thanks for your help,
Mathieu


@SuppressWarnings("restriction")
public class MyResourceContainerRelativeLocationConverter implements IIndexLocationConverter{
...   
    public IIndexFileLocation fromInternalFormat(String raw) {
        IIndexFileLocation result;
        if (raw.charAt(0) == product) {
            String fullPath = raw.substring(1);
            URI fileUri = URIUtil.toURI(fullPath);
            IContainer[] containers = root.findContainersForLocationURI(fileUri);
            if (containers.length < 1) {
                //result = new IndexFileLocation(fileUri, null);
                result = null;
            } else {
                result = new IndexFileLocation(fileUri, containers[0].getFullPath().toString());
            }
        } else {
            return null;
            //result = new IndexFileLocation(URIUtil.toURI(raw), null);

        }
      //System.out.println("MyResourceContainerRelativeLocationConverter fromInternalFormat Convert RAW ["+ raw+ "] to URI [" + result.getURI() +"] fullPath [" + result.getFullPath() + "]");
      return result;
    }

    /*
     * (non-Javadoc)
     * @see org.eclipse.cdt.core.index.IIndexLocationConverter#toInternalFormat(org.eclipse.cdt.core.index.IIndexFileLocation)
     */
    public String toInternalFormat(IIndexFileLocation location) {
        if (location.getFullPath() == null) {
            //System.out.println("MyResourceContainerRelativeLocationConverter toInternalFormat Convert  URI [" + location.getURI() +"] fullPath [" + location.getFullPath() + "] to [" + null + "]");
            //return absolutePath;
            return null;
        } else {
            String absolutePath = URIUtil.toPath(location.getURI()).toString();

            StringBuffer result = new StringBuffer();
            result.append(product).append(absolutePath);
            //System.out.println("MyResourceContainerRelativeLocationConverter toInternalFormat Convert  URI [" + location.getURI() +"] fullPath [" + location.getFullPath() + "] to [" + result.toString() + "]");
            return result.toString();
        }
       
    }






Back to the top