Blob Blame History Raw
From 67916542f15a5ac6d18b2ec32db872fcfb1f9547 Mon Sep 17 00:00:00 2001
From: Michael Keppler <Michael.Keppler@gmx.de>
Date: Wed, 9 Oct 2019 16:12:36 +0200
Subject: [PATCH 5/6] Bug 551974 - [performance] DefaultBundleReader manifest
 cache too small

Use an unlimited manifest cache to avoid repeated disk access. Before
the change resolving the target platform of a custom eclipse application
took several minutes, spending the majority of the time in reading
manifests from .jar files again and again.

With the unlimited cache in place, the time spent for reading the
manifests from the jars drops from several minutes to 3 seconds. The
manifest cache contains 761 entries and uses 3.6 MB in my case.

Change-Id: I34175635754b57a6cfa002a595b6716209e96c69
Signed-off-by: Michael Keppler <Michael.Keppler@gmx.de>
---
 .../eclipse/tycho/core/osgitools/DefaultBundleReader.java    | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/tycho-core/src/main/java/org/eclipse/tycho/core/osgitools/DefaultBundleReader.java b/tycho-core/src/main/java/org/eclipse/tycho/core/osgitools/DefaultBundleReader.java
index 43e34f6..c44b201 100644
--- a/tycho-core/src/main/java/org/eclipse/tycho/core/osgitools/DefaultBundleReader.java
+++ b/tycho-core/src/main/java/org/eclipse/tycho/core/osgitools/DefaultBundleReader.java
@@ -16,7 +16,9 @@ import java.io.FileOutputStream;
 import java.io.IOException;
 import java.io.InputStream;
 import java.util.Enumeration;
+import java.util.HashMap;
 import java.util.HashSet;
+import java.util.Map;
 import java.util.Set;
 import java.util.jar.JarFile;
 import java.util.zip.ZipEntry;
@@ -26,7 +28,6 @@ import org.codehaus.plexus.component.annotations.Component;
 import org.codehaus.plexus.component.annotations.Requirement;
 import org.codehaus.plexus.logging.AbstractLogEnabled;
 import org.codehaus.plexus.util.IOUtil;
-import org.eclipse.tycho.core.shared.LRUCache;
 import org.eclipse.tycho.locking.facade.FileLockService;
 import org.eclipse.tycho.locking.facade.FileLocker;
 
@@ -34,7 +35,7 @@ import org.eclipse.tycho.locking.facade.FileLocker;
 public class DefaultBundleReader extends AbstractLogEnabled implements BundleReader {
 
     public static final String CACHE_PATH = ".cache/tycho";
-    private final LRUCache<String, OsgiManifest> manifestCache = new LRUCache<>(50);
+    private final Map<String, OsgiManifest> manifestCache = new HashMap<>();
 
     private File cacheDir;
     private Set<String> extractedFiles = new HashSet<>();
-- 
2.21.1