Closed Bug 856368 Opened 12 years ago Closed 12 years ago

Some nsPresArena improvements

Categories

(Core :: Layout, defect)

defect
Not set
minor

Tracking

()

RESOLVED FIXED
mozilla23

People

(Reporter: MatsPalmgren_bugz, Assigned: MatsPalmgren_bugz)

Details

(Keywords: perf)

Attachments

(6 files, 1 obsolete file)

1. remove DEBUG_TRACEMALLOC_PRESARENA -- it's not very useful now that we have valgrind/ASan annotations and it blocks other improvements 2. get rid of the extra indirection through the mState pointer, we should just store that data in the nsPresArena itself I'm dividing this into several patches for easier review of each step.
Attachment #731569 - Flags: review?(roc)
This is probably easier to review without the white-space changes.
Attachment #731571 - Flags: review?(roc)
Attachment #731570 - Flags: review?(roc)
Attached patch Remove #include of nscore.h (obsolete) — Splinter Review
Attachment #731574 - Flags: review?(roc)
Attached patch Comment fixesSplinter Review
Attachment #731575 - Flags: review?(roc)
(In reply to Mats Palmgren [:mats] from comment #0) > 1. remove DEBUG_TRACEMALLOC_PRESARENA -- it's not very useful now that we > have valgrind/ASan annotations and it blocks other improvements I've used it for other things. And it really should be trivial to readd support at the end of the patch series, no? (In reply to Mats Palmgren [:mats] from comment #6) > Created attachment 731574 [details] [diff] [review] > Remove #include of nscore.h NS_HIDDEN makes non-virtual functions substantially faster in the cases where it kicks in (since on some platforms non-virtual functions that are exposed across library boundaries are performance-wise like virtual functions). Is this really unused? (Did we solve that problem globally with libxul?)
(In reply to David Baron [:dbaron] (don't cc:, use needinfo? instead) from comment #9) > I've used it for other things. Could you describe what other things? > And it really should be trivial to readd > support at the end of the patch series, no? Yes, but I have further improvements in mind and I think DEBUG_TRACEMALLOC_PRESARENA would make those more complicated. My idea is to make all pres arenas aligned on a page boundary so that you can take any arena allocated object and find the arena header with a bit mask on its address, then store mPresContext/Shell there for fast access, replacing the slow indirection we do through nsIFrame->mStyleContext->mRuleNode->mPresContext[->mPresShell] (and, maybe get rid of mPresContext on the rule node?) > NS_HIDDEN makes non-virtual functions substantially faster in the cases > where it kicks in. OK, I'll keep them.
Flags: needinfo?(dbaron)
Attachment #731574 - Attachment is obsolete: true
Attachment #731574 - Flags: review?(roc)
(In reply to David Baron [:dbaron] (don't cc:, use needinfo? instead) from comment #9) > NS_HIDDEN makes non-virtual functions substantially faster in the cases > where it kicks in All these methods are now defined in the class though, eg: void FreeByFrameID(nsQueryFrame::FrameIID aID, void* aPtr) { Free(aID, aPtr); } I'd be very surprised if the compiler didn't inline that at the call site. I guess NS_HIDDEN could help a bit with link time/size though. If NS_HIDDEN makes the above faster *to call* then we have a lot of room to optimize our code ;-)
Waldo, is there a reason mfbt/Attributes.h doesn't have a MOZ_HIDDEN ?
(In reply to Mats Palmgren [:mats] from comment #10) > (In reply to David Baron [:dbaron] (don't cc:, use needinfo? instead) from > comment #9) > > I've used it for other things. > > Could you describe what other things? I don't remember, but I'm reasonably confident I have. > > And it really should be trivial to readd > > support at the end of the patch series, no? > > Yes, but I have further improvements in mind and I think > DEBUG_TRACEMALLOC_PRESARENA would make those more complicated. > > My idea is to make all pres arenas aligned on a page boundary so that > you can take any arena allocated object and find the arena header with > a bit mask on its address, then store mPresContext/Shell there for fast > access, replacing the slow indirection we do through > nsIFrame->mStyleContext->mRuleNode->mPresContext[->mPresShell] > (and, maybe get rid of mPresContext on the rule node?) OK, that sounds reasonable. Though it still should be trivial to readd at the end (by just bloating allocations with the prescontext pointer at the beginning).
Flags: needinfo?(dbaron)
(In reply to Mats Palmgren [:mats] from comment #12) > Waldo, is there a reason mfbt/Attributes.h doesn't have a MOZ_HIDDEN ? No particular reason. (And needinfo? is probably desirable in addition to CCing me, just in case I miss the bugmail.)
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: