I need to think about this some more, but I'm concerned that optimizing the case where there are no rules is the wrong approach. If I add just one rule that never applies but happens to have a property that matches, then all the performance "gain" is lost. Similarly, if I add just a few applicable styles, the system is apparently going to perform poorly. So, I think we have to look more closely at the cost of the style binding mechanism and see how to amortize that for not just the "no applicable rules" case but also the "few applicable rules" case and the "many applicable rules" case.
On 2009-10-24, at 05:35, Max Carlson wrote: > Change 20091024-maxcarlson-A by [email protected] on 2009-10-24 > 02:19:44 PDT > in /Users/maxcarlson/openlaszlo/trunk-clean > for http://svn.openlaszlo.org/openlaszlo/trunk > > Summary: Second pass at adding default style attributes to view > > Bugs Fixed: LPP-8556 - Add default CSS style properties to <view> > (partial) > > Technical Reviewer: ptw > QA Reviewer: hminsky > > Details: This change attempts to keep the cost of adding default style > bindings as low as possible. Adding them to views by default is very > expensive! > > LzCSSStyle - Keep list of all CSS properties that could potentially be > applied, and flag for whether there are any properties or not. > > LzNode - Attempt to update __LZhasConstraint() to deal with style > constraints better, but it gets called to early to evaluate styles : > ( - may not be necessary anyhow. Correct warnings in > __LZstyleBindAttribute() to match their description. Don't apply > style args if there are no style rules. Don't bind style constraints > that can't possibly be applied. > > LaszloView - Aggregate font style lookups and defer to init(). > > Tests: Profiling in firebug shows that this testcase is almost as fast > as before when the stylesheet is eliminated, or the CSS properties are > renamed to ones that don't match the default style attributes in > LaszloView: > > <canvas height="400"> > <stylesheet> > #win { > width: 300; > height: 200; > background-color: 'purple'; > } > </stylesheet> > > <button>Make 1000 views > <handler name="onclick"> > <![CDATA[ > for (var i = 0; i < 1000; i++) { > new lz.view(canvas, {}) > } > ]]> > </handler> > </button> > </canvas> > > > Files: > M WEB-INF/lps/lfc/services/LzCSSStyle.lzs > M WEB-INF/lps/lfc/core/LzNode.lzs > M WEB-INF/lps/lfc/views/LaszloView.lzs > > Changeset: > http://svn.openlaszlo.org/openlaszlo/patches/20091024-maxcarlson-A.tar > _______________________________________________ > Laszlo-reviews mailing list > [email protected] > http://www.openlaszlo.org/mailman/listinfo/laszlo-reviews _______________________________________________ Laszlo-reviews mailing list [email protected] http://www.openlaszlo.org/mailman/listinfo/laszlo-reviews
