Bug 80718 - Bundle.getEntry("/") could be faster
Summary: Bundle.getEntry("/") could be faster
Status: RESOLVED FIXED
Alias: None
Product: Platform
Classification: Eclipse Project
Component: Runtime (show other bugs)
Version: 3.1   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: 3.1 M6   Edit
Assignee: Thomas Watson CLA
QA Contact:
URL:
Whiteboard:
Keywords:
: 83865 (view as bug list)
Depends on:
Blocks: 61944
  Show dependency tree
 
Reported: 2004-12-10 14:05 EST by Thomas Watson CLA
Modified: 2005-04-01 15:00 EST (History)
4 users (show)

See Also:


Attachments
patch to remove calls to Bundle.getEntry("/") (1.13 KB, patch)
2005-02-28 12:06 EST, Thomas Watson CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Thomas Watson CLA 2004-12-10 14:05:23 EST
The Bundle.getEntry(String) method will return null if the the path "/" is 
used.  A path of "/" indicates the root of the bundle and should never return 
null.
Comment 1 Thomas Watson CLA 2004-12-10 14:18:29 EST
A fix is in HEAD.
Comment 2 Thomas Watson CLA 2005-01-27 15:56:47 EST
*** Bug 83865 has been marked as a duplicate of this bug. ***
Comment 3 Dan Kehn CLA 2005-01-28 11:37:33 EST
Meta-comment... during performance analysis of Eclipse I/O, I noticed that 
Bundle.getEntry("/") is called a lot and each time File.exists() is ultimately 
called. It might be worth adding a check for this case to reduce I/O events, 
since it's pretty safe to assume that if the bundle exists, it has a root 
entry.
Comment 4 Jeff McAffer CLA 2005-01-28 12:40:06 EST
reopening to track the performance suggestion.
Comment 5 Gary Karasiuk CLA 2005-01-28 12:50:12 EST
Can we get this fixed in the 3.0 stream please. 
Comment 6 Jeff McAffer CLA 2005-01-31 12:19:58 EST
risk assessment?

Dan, can you quantify "called a lot"?
Comment 7 Dan Kehn CLA 2005-01-31 13:20:55 EST
Re: Comment #6

Good question! Bundle.getEntry was called 46 times from startup until the Java 
perspective opened. Opening the JVE editor added 154 calls. The code 
modification to capture this data is below (from AbstractBundle):

  private static long getEntry = 0;
  public URL getEntry(String fileName) {
    //XXX dbk AbstractBundle.getEntry
    if (fileName.equals("/")) {
      getEntry++;
      System.out.println("AbstractBundle.getEntry #" + getEntry);
    }
    ...
  }

It's a little surprising that the JVE is calling this 3x more than the base 
Eclipse / Java perspective. We'll look into that.
Comment 8 Dan Kehn CLA 2005-02-23 17:30:02 EST
Time to update the milestone to M6... ?
Comment 9 Jeff McAffer CLA 2005-02-24 00:36:03 EST
but then we don't get to use our time machines...
Comment 10 Gili Mendel CLA 2005-02-24 10:17:22 EST
Hey guys, is there a "real time" target miletone plan for this?  
Comment 11 Jeff McAffer CLA 2005-02-24 23:51:41 EST
Not sure how that happend.  It was supposed to be set to 3.1.  There are no 
commitments as yet.  The impact has not been investigated.
Comment 12 Thomas Watson CLA 2005-02-28 12:04:09 EST
The performance improvement from comment 3 could be done.  But I'm more 
concerned about why Bundle.getEntry("/") is getting called so much ...

One place where this gets called often is when Platform URL gets resolved in 
org.eclipse.core.internal.runtime.PlatformURLPluginConnection.resolve().  This 
could easily be fixed to not call Bundle.getEntry("/").  I will attach a 
patch ...

Comment 13 Thomas Watson CLA 2005-02-28 12:06:44 EST
Created attachment 18367 [details]
patch to remove calls to Bundle.getEntry("/")

This patch avoids calling Bundle.getEntry("/") for the common case where the
resource to a platform URL exists.  In cases where it does not exist we have to
call Bundle.getEntry("/") to construct a URL which will throw a
FileNotFoundExcepion when used.
Comment 14 Pascal Rapicault CLA 2005-03-15 15:48:30 EST
The last patch has been released in HEAD.
Tom are you planning to do more?
Comment 15 Thomas Watson CLA 2005-03-15 16:20:46 EST
I do not plan to make any more changes.

Any enhancements to make Bundle.getEntry("/") faster would only affect non-
jar'ed bundles since since the File.exists() check is only done for non-jar'ed 
bundles.

I think it is a better thing to make Bundle.getEntry("/") not called as often 
(or at all in normal situations).  This will improve both jar'ed and non-
jar'ed bundles.

should this be closed then?
Comment 16 DJ Houghton CLA 2005-04-01 15:00:47 EST
No more improvements planned.

Closing.