This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 29404 - Add Tag lib to repository action is slow
Summary: Add Tag lib to repository action is slow
Status: VERIFIED FIXED
Alias: None
Product: javaee
Classification: Unclassified
Component: Code (show other bugs)
Version: 3.x
Hardware: PC Linux
: P2 blocker (vote)
Assignee: sgleason
URL:
Keywords: PERFORMANCE
Depends on:
Blocks:
 
Reported: 2002-12-09 14:03 UTC by _ rkubacki
Modified: 2003-03-04 03:52 UTC (History)
0 users

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description _ rkubacki 2002-12-09 14:03:24 UTC
enable() method of this action searches for
META-INF/taglib.tld for JAR files created by IDE
(with jarContent). 

This is wrong approach because now the valid name
is not only taglib.tlb.

This is slow because it requires access to JAR
entries.
Comment 1 sgleason 2003-01-15 21:35:56 UTC
A more valid definition of what is a tag library jar would be 
whether there is any file with extension ".tld" in META-INF. 

The performance hit on accessing the contents of the jar 
file is probably OK, because jars are not added to the 
repository very often. 
Comment 2 _ rkubacki 2003-02-05 13:07:01 UTC
Performance hit is not OK. Doing I/O activities during enable action
breaks possibility to meet criteria for UI responsiveness of context
menu and top level menu and it affects all jar files regardless if
they are taglib or not.
Comment 3 sgleason 2003-02-07 00:13:36 UTC
Here is a summary of the discussions about possible solutions to
this performance issue:


The issue:  with the possibility of multiple tag libraries in 
            a jar, tag library jars are harder to differentiate
            from other jars. 
            
            Specifically, this causes a performance problem in 
            a context-sensistive tools menu item (Add to Tag Library 
            Repository) that is currently only enabled on tag library
            jars. 
            
            The underlying problem is that we have to open the jar (a 
            file  i/o operation) and scan the names of the entries
            until we find one in /META-INF with extension ".tld".
            Radim's tests indicate that this can range from 20 ms for
            jars that are quickly found to be tag library jars, to 
            200 or 300 ms for large jars that aren't tag library jars
            (must scan all entries to make a negative conclusion). 
            This is too much time for an enable action, given that 
            the UI requirement for a context menu is 100 ms. 

            (Radim's email from 2/4 describes when the enable method
             for this action gets called.)
            
One possible mitigation:            
	    If we first test for the presence of the /META-INF 
	    directory, we can quickly make negative judgements
	    on some non-taglibrary jars. 
	    
	    Two problems with this: 1. most jars have manifests in 
	    /META-INF anyways; 2. some zip creators don't create entries
	    for directories. 

            So this doesn't seem like a reasonable workaround. 
	    
Three possible solutions:

            0. Eliminate the menu item. 
            
               However, I remember that this menu item has been used
in 
               our tutorials and in a user-written tutorial. 
               (I found out I was wrong about the user-written
               tutorial -- he was talking about putting tag libraries
               into the CVS repository. So much for running my brain 
               so early in the morning :)
               
            1. Don't do the full isTaglibJar() check on the enable, 
               but rather do it during action performed, and if not
               a tag library jar, inform the user with a (nicely 
               worded) dialog that indicates that the jar doesn't 
               have tag libraries in it and so won't be added to 
               the repository. 
               
               This seems like bait-and-switch on the menu item and
               doesn't fit with the idea of context-sensitive menu
items. 
               In other words, HIE doesn't like this one. There is a
precedent, 
               however: if the user selects the execute action on a
java file
               with no main() method, a dialog will come up informing
the user
               of such. 
               
            2. Simply allow non-taglibrary jars in the repository. 
            
               For nevada, this can be OK, since the user will simply
               get a library in their WEB-INF/lib that isn't a tag 
               library. There's a small risk of semantic confusion,
	       since we call it the tag library repository. 
               
               However, this poses a bigger problem for later
versions, 
               where we plan to redesign the tag library repository to 
               be tld-centric. If there are non-taglib jars in a
user's
               repository, then we will have a difficult time
upgrading the
               repository for the user.  
               
               


Comment 4 Jason Rush 2003-02-07 00:43:20 UTC
The solution recommended by HIE (renaming contextual menu 
item and adding a dialog when attempting to add a non-TL 
jar to the repository) has minimal impact on QA.  QA 
approves of this change for Nevada/NB 3.5.
Comment 5 leslie-robertson 2003-02-07 18:55:29 UTC
You have my blessing. I'll communicate this change to Chris.
Comment 6 sgleason 2003-02-08 01:59:25 UTC
recommended fix implemented. 
Comment 7 Jason Rush 2003-03-04 03:52:00 UTC
Verified in NetBeans dev build 200303030100.