tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bugzi...@apache.org
Subject DO NOT REPLY [Bug 43741] New: - .tag files in a .tar recompiled for each .jsp -- extremely slow (with fix)
Date Wed, 31 Oct 2007 04:10:51 GMT
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG·
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=43741>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND·
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=43741

           Summary: .tag files in a .tar recompiled for each .jsp --
                    extremely slow (with fix)
           Product: Tomcat 6
           Version: 6.0.9
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: major
          Priority: P2
         Component: Jasper
        AssignedTo: tomcat-dev@jakarta.apache.org
        ReportedBy: aberglas@rsa.com


Jasper is *extremely* slow at compiling .tag files packaged in a .jar -- tens 
of seconds per JSP. One cause is that .tag files are repeatedly recompiled for 
each .jsp even though they have not changed.

The following few lines fix this.  The added code is marked between // --------
 AJB markers.  
It effectively turns off the timestamp checking on .jar files.

This does NOT actually introduce a bug.  There is an existing bug in that .jsp 
files are not 
automatically recompiled if any .tags in .jars are changed.  So you need to 
purge work in either case.  
A proper fix would be to check dependencies properly, at least to the .jar 
file itself.  
But the current fix is *much* better that the existing behavior.

There are better solutions, but an 80% solution is better than no solution.


// Tomcat 6.0.10 Src deployed version.

public class JspCompilationContext {...

    public void compile() throws JasperException, FileNotFoundException {
        createCompiler();

        // ------------ begin AJB
        // Hack to stop .tag files that are packaged in .jars being recompiled 
for every single .jsp that uses them.
        // The hack means that .tag files will not be automatically recompiled 
if they change -- you need to delete work area.
        // But that was actually an existing bug -- .jsps are not dependent on 
the .tag .jars so the work area needed deleting anyway.
        // (Outstanding is to compile multiple .tags in one pass and so make 
the process Much faster.)
        boolean outDated;
        if (isPackagedTagFile) outDated = ! new File(getClassFileName()).exists
();
        else outDated = jspCompiler.isOutDated();
//        AjbLog.log("### Compiler.compile " + jspUri + " pkgTagFile " + 
isPackagedTagFile + " outDated " + outDated + " " + getClassFileName());
        if (outDated) {
//     if (isPackagedTagFile || jspCompiler.isOutDated()) { // original code.
//     ---------------- end AJB
            try {
                jspCompiler.removeGeneratedFiles();
                jspLoader = null;
                jspCompiler.compile();
                jsw.setReload(true);
                jsw.setCompilationException(null);
            } catch (JasperException ex) {
                // Cache compilation exception
                jsw.setCompilationException(ex);
                throw ex;
            } catch (Exception ex) {
                JasperException je = new JasperException(
                            Localizer.getMessage("jsp.error.unable.compile"),
                            ex);
                // Cache compilation exception
                jsw.setCompilationException(je);
                throw je;
            }
        }
    }

-- 
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


Mime
View raw message