incubator-adffaces-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Andy Schwartz (JIRA)" <>
Subject [jira] Created: (ADFFACES-394) Style sheet processing optimization
Date Fri, 02 Mar 2007 23:26:51 GMT
Style sheet processing optimization

                 Key: ADFFACES-394
             Project: MyFaces ADF-Faces
          Issue Type: Improvement
          Components: Skinning
    Affects Versions: 2.0.0-incubating-core-SNAPSHOT, 1.0.0-incubating-core-SNAPSHOT
         Environment: Windows XP
            Reporter: Andy Schwartz
            Priority: Minor

While investigating performance of initial page delivery I noticed that on the very first
page delivery a large percentage of the time is spent in style sheet processing code.  In
particular, a bit of profiling reveals that StyleSheetDocument.getStyles() - specifically
the calls to _resolveStyle() - can be expensive.  On a slower machine with a large custom
stylesheet this can add up to several seconds.  Interestingly, this particular performance
problem is self-documenting...  The following comment taken from

    // Now, loop through all StyleNodes in all StyleSheetNodes
    // Note: The algorithm used here is actually much more inefficient
    // than it needs to be.  We're using a n-squared algorithm here -
    // for every style we find, we need to loop through all other styles.
    // The reason for this is because this allows us to share code
    // (namely _resolveStyle()) with getStyleBySelector/Name().  However,
    // we could probably double the performance of CSS generation by
    // optimizing this routine to make a single pass through all styles,
    // and then resolve everything in one step.  

Leaving aside questions about whether "doubling" the performance would be the actual result
:-)  , the idea is that this would work as follows:

- First pass built up a mappings from selector/name to a list of matching StyleNodes.
- The second pass then resolves the styles based on the mappings created in the first pass.

This should avoid the current n-squared behavior and presumably reduce the amount of time
spent in this code, thus speeding up initial page delivery.

This message is automatically generated by JIRA.
You can reply to this email to add a comment to the issue online.

View raw message