Performance/Optimizing JavaScript with DTrace: Difference between revisions

m
(first version of what I learned optimizing the site-specific full zoom setting with DTrace)
 
Line 71: Line 71:
   }
   }
  }
  }
* Inline logic that gets called frequently to reduce the costs of function invocation and variable initialization.
* Inline logic that gets called frequently to eliminate the cost of function invocation.
* Dig into costly XBL and native code, since it might be the code doing unnecessary work.  For example, when optimizing the site-specific full zoom setting, I found that browser.xml wasn't memoizing its frequently-accessed <tt>_docShell</tt> property, even though the value of that property doesn't change over the lifetime of a browser widget, and I also found that <tt>nsPresContext::SetFullZoom</tt> was doing some unnecessary work when the new value was the same as the old one.
* Dig into costly XBL and native code, since it might be doing unnecessary work.  For example, when optimizing the site-specific full zoom setting, I found that browser.xml wasn't memoizing its frequently-accessed <tt>_docShell</tt> property, even though the value of that property doesn't change over the lifetime of a browser widget, and I also found that <tt>nsPresContext::SetFullZoom</tt> was doing some unnecessary work when the new value was the same as the old one.


== Bugs ==
== Bugs ==
canmove, Confirmed users
2,056

edits