I was profiling changing the product on the bugzilla query page (which kicks off a bunch of reflows) and found that a lot of time (20% or so) was being spent under nsTextFrame::IsEmpty (getting style data, QIing the content node, calling IsOnlyWhitespace, etc). There were a lot of repeat calls, so it may make sense to cache the IsEmpty state on the frame itself.
Comment on attachment 155238 [details] [diff] [review] Like so, perhaps I have to admit that I don't know how much overall impact this will have on things. For the testcase I was looking at, the time in nsTextFrame::IsEmpty dropped by a factor of 10 or so. The cached state was hit almost every single time (only 3% of the time under IsEmpty() was spent actually getting style data or calling IsOnlyWhitespace or any of that stuff).
13 years ago
Comment on attachment 155238 [details] [diff] [review] Like so, perhaps + NS_ASSERTION(mState & TEXT_IS_EMPTY == 0 || + mState & TEXT_ISNOT_EMPTY == 0, "Invalid state"); I think this is incorrect since == has higher precendence than &. So you're getting (mState & (TEXT_IS_EMPTY == 0)) || (mState & (TEXT_ISNOT_EMPTY == 0)) which should always be firing... Well, even if I'm wrong, I prefer the clearer !(mState & TEXT_IS_EMPTY) || !(mState & TEXT_ISNOT_EMPTY)
Made that change and checked in. No Tp impact.
Reopening. It looks like Tp on btek did go up a bit after all.
Created attachment 155729 [details] [diff] [review] Trying to not regress Tp (apply on top of other patch)
Yeah, that helped Tp. Fixed.