Closed
Bug 92543
Opened 24 years ago
Closed 18 years ago
BandRect.mFrames should be created as an nsAutoVoidArray
Categories
(Core :: Layout, defect, P2)
Core
Layout
Tracking
()
VERIFIED
FIXED
mozilla1.9alpha8
People
(Reporter: jesup, Assigned: alfredkayser)
References
Details
Attachments
(1 file, 6 obsolete files)
|
29.34 KB,
patch
|
Details | Diff | Splinter Review |
When it's created, mFrames always has 2 elements. It's a good candidate for an
nsAutoVoidArray to a void extra allocations. If it commonly has >> 8 entries
(which I don't think it does), it might want to be allocated as
nsVoidArray(probable size).
| Reporter | ||
Comment 1•24 years ago
|
||
The space manager's tricks to avoid creating nsVoidArrays for single-element
entries may want to be folded into nsVoidArray itself for more general use.
Note also that the 2 words of storage used for the count and the union are the
same amount of storage that an inline nsVoidArray member would take - but of
course you can't store a aingle entry in it.
Updated•24 years ago
|
Target Milestone: --- → mozilla1.0.1
Comment 3•23 years ago
|
||
Moving Mozilla 1.01 bugs to 'future' milestone with priority P1
I will be pulling bugs from 'future' milestones when scheduling later work.
Priority: -- → P1
Target Milestone: mozilla1.0.1 → Future
Updated•23 years ago
|
Keywords: mozilla1.0+
Updated•23 years ago
|
Hardware: PC → All
Updated•23 years ago
|
Priority: P1 → P2
| Reporter | ||
Comment 4•23 years ago
|
||
Attinasi is gone, re-taking bug
| Assignee | ||
Comment 5•18 years ago
|
||
Or possibly nsSmallVoidArray is a better candidate for replacement of the single-element trickery in BandRect?
It will mean some code simplification and reduction in nsSpaceManager.cpp.
(see http://developer.mozilla.org/en/docs/XPCOM_array_guide )
| Assignee | ||
Comment 6•18 years ago
|
||
In Trapezoid merge mState, mFrame and mFrames into one nsSmallVoidArray mFrames (which has all the optimization for arrays with one entry)
Same for BandRect: merge mNumFrames and mFrames into one nsSmallVoidArray mFrames.
Compiled and verified with wide range of site, including acid2, meyerweb's floating CSS demos.
| Assignee | ||
Comment 7•18 years ago
|
||
notes:
nsSmallVoidArray only uses 4 bytes for its class structure, and when only one item is stored, those 4 bytes are used as the pointer to the item.
By also making the nsSmallVoidArray mFrame direct embedding in the BandRect/Trapezoid classes, there is no need for a pointer to the nsSmallVoidArray, and there is no need for a separate new/alloc to create the nsSmallVoidArray.
So:
Old: 4 bytes for pointer, 4 bytes for state/numframes, 4 bytes (allocated) for nsVoidArray and 4 bytes allocated for each entry in array.
New: 4 bytes for nsSmallVoidArray and for 99% of the cases no more allocations... Also some code reduction/simplification.
+ mFrames.AppendElement((void*)aFrame);
+ }
+ void RemoveFrame(const nsIFrame* aFrame) {
+ mFrames.RemoveElement((void*)aFrame);
void* casts not needed.
+ return (nsIFrame*) mFrames.FastElementAt(index);
Use NS_STATIC_CAST.
- if (1 == aBand->mNumFrames) {
- trapezoid->mState = nsBandTrapezoid::Occupied;
- trapezoid->mFrame = aBand->mFrame;
+ if (1 == aBand->mFrames.Count()) {
+ trapezoid->mFrames = &aBand->mFrames;
} else {
- NS_ASSERTION(aBand->mNumFrames > 1, "unexpected frame count");
- trapezoid->mState = nsBandTrapezoid::OccupiedMultiple;
- trapezoid->mFrames = aBand->mFrames;
+ NS_ASSERTION(aBand->mFrames.Count() > 1, "unexpected frame count");
+ trapezoid->mFrames = &aBand->mFrames;
You don't need this if statement anymore, right? You could modify the assertion instead...
+ const nsSmallVoidArray* mFrames; // list of frames occupying the space
Could you document what this is really for? If it always points to the mFrames of some BandRect, it might be clearer if we just have a pointer to the BandRect here. Can it ever actually be null?
| Assignee | ||
Comment 9•18 years ago
|
||
Addressed comments from roc:
* remove casts from Append/RemoveElement
* use NS_STATIC_CAST
* added more comments to mFrames in trapezoid.
Note, the mFrames in trapezoid is used by BlockBandData to walk through the frames. Replacing that with BandRect will mean that the BandRect struct also needs to be explosed outside nsSpaceManager.
Attachment #268835 -
Attachment is obsolete: true
Attachment #268835 -
Flags: review?(roc)
Attachment #269192 -
Flags: review?(roc)
Comment on attachment 269192 [details] [diff] [review]
V2: Fixed comments from ROC
+ nsIFrame* f = (nsIFrame*) frames->ElementAt(j);
NS_STATIC_CAST
+ const nsSmallVoidArray *frames = trapezoid->mFrames;
const nsSmallVoidArray* frames
(and elsewhere)
Attachment #269192 -
Flags: superreview+
Attachment #269192 -
Flags: review?(roc)
Attachment #269192 -
Flags: review+
| Assignee | ||
Comment 11•18 years ago
|
||
Who can do the checkin for me?
Attachment #269192 -
Attachment is obsolete: true
| Assignee | ||
Updated•18 years ago
|
Keywords: perf → checkin-needed
Comment 12•18 years ago
|
||
mozilla/layout/generic/nsBlockBandData.cpp 1.51
mozilla/layout/generic/nsSpaceManager.cpp 3.78
mozilla/layout/generic/nsSpaceManager.h 3.48
Status: ASSIGNED → RESOLVED
Closed: 18 years ago
Flags: in-testsuite-
Keywords: checkin-needed
Resolution: --- → FIXED
Target Milestone: mozilla1.3alpha → mozilla1.9beta1
Comment 13•18 years ago
|
||
Backed out, because this breaks debug builds.
According to josh: 'struct nsBandTrapezoid' has no member named 'mState' in nsPresShell.cpp:6595 and 6620. Looking at those lines there indeed seem to be code that needs updating. I can't read the patch myself now to figure it out.
mozilla/layout/generic/nsBlockBandData.cpp 1.52
mozilla/layout/generic/nsSpaceManager.cpp 3.79
mozilla/layout/generic/nsSpaceManager.h 3.49
Updated•18 years ago
|
Status: RESOLVED → REOPENED
Resolution: FIXED → ---
| Assignee | ||
Comment 14•18 years ago
|
||
Note, the problem in nsPresShell.cpp is in ifdef DEBUG code.
It can be easily fixed by replacing
trap1[trapIndex].mState == trap2[trapIndex].mState;
with
(trap1[trapIndex].mFrame!=nsnull) == (trap2[trapIndex].mFrame!=nsnull);
(as the test is about verification that two trees are built up in the same way...)
(updated patch coming...)
Status: REOPENED → ASSIGNED
| Assignee | ||
Comment 15•18 years ago
|
||
Attachment #272648 -
Attachment is obsolete: true
| Assignee | ||
Updated•18 years ago
|
Attachment #275400 -
Flags: approval1.9?
That patch seems to include part of another patch.
Also, the NS_STATIC_CAST(T, V) should now be a static_cast<T>(V).
Is this patch doing what the bug summary says? Or something else in addition?
| Assignee | ||
Comment 18•18 years ago
|
||
Previous patch included accidentally another patch from same directory.
Note, this patch is all about replacing:
State mState; // state of the space
union {
nsIFrame* mFrame; // single frame occupying the space
const nsVoidArray* mFrames; // list of frames occupying the space
};
with just:
const nsSmallVoidArray* mFrames; // list of frames occupying the space
This touches some code, mostly making it simpler, as the optimization for the 'single frame' case is allready within nsSmallVoidArray.
Attachment #275400 -
Attachment is obsolete: true
Attachment #275400 -
Flags: approval1.9?
| Assignee | ||
Updated•18 years ago
|
Attachment #278215 -
Flags: approval1.9?
Comment on attachment 278215 [details] [diff] [review]
Patch without the nsObjectFrame part
a1.9=dbaron
Attachment #278215 -
Flags: approval1.9? → approval1.9+
| Assignee | ||
Comment 20•18 years ago
|
||
Minor follow-up in bug 393781 for further optimization.
Blocks: 393781
| Assignee | ||
Updated•18 years ago
|
Keywords: checkin-needed
Comment 21•18 years ago
|
||
Checking in mozilla/layout/base/nsPresShell.cpp;
/cvsroot/mozilla/layout/base/nsPresShell.cpp,v <-- nsPresShell.cpp
new revision: 3.1052; previous revision: 3.1051
done
Checking in mozilla/layout/generic/nsBlockBandData.cpp;
/cvsroot/mozilla/layout/generic/nsBlockBandData.cpp,v <-- nsBlockBandData.cpp
new revision: 1.53; previous revision: 1.52
done
Checking in mozilla/layout/generic/nsSpaceManager.cpp;
/cvsroot/mozilla/layout/generic/nsSpaceManager.cpp,v <-- nsSpaceManager.cpp
new revision: 3.83; previous revision: 3.82
done
Checking in mozilla/layout/generic/nsSpaceManager.h;
/cvsroot/mozilla/layout/generic/nsSpaceManager.h,v <-- nsSpaceManager.h
new revision: 3.50; previous revision: 3.49
done
Status: ASSIGNED → RESOLVED
Closed: 18 years ago → 18 years ago
Keywords: checkin-needed
Resolution: --- → FIXED
Comment 22•18 years ago
|
||
Backed out due to build bustage:
c++ -o nsPresShell.o -c -I../../dist/include/system_wrappers -include /builds/tinderbox/Fx-Trunk-Debug/Linux_2.6.9-42.ELsmp_Depend/mozilla/config/gcc_hidden.h -DMOZILLA_INTERNAL_API -DOSTYPE=\"Linux2.6.9-42\" -DOSARCH=Linux -D_IMPL_NS_LAYOUT -I/builds/tinderbox/Fx-Trunk-Debug/Linux_2.6.9-42.ELsmp_Depend/mozilla/layout/base -I/builds/tinderbox/Fx-Trunk-Debug/Linux_2.6.9-42.ELsmp_Depend/mozilla/layout/base/../generic -I/builds/tinderbox/Fx-Trunk-Debug/Linux_2.6.9-42.ELsmp_Depend/mozilla/layout/base/../forms -I/builds/tinderbox/Fx-Trunk-Debug/Linux_2.6.9-42.ELsmp_Depend/mozilla/layout/base/../tables -I/builds/tinderbox/Fx-Trunk-Debug/Linux_2.6.9-42.ELsmp_Depend/mozilla/layout/base/../printing -I/builds/tinderbox/Fx-Trunk-Debug/Linux_2.6.9-42.ELsmp_Depend/mozilla/layout/base/../xul/base/src -I/builds/tinderbox/Fx-Trunk-Debug/Linux_2.6.9-42.ELsmp_Depend/mozilla/layout/base/../../content/base/src -I/builds/tinderbox/Fx-Trunk-Debug/Linux_2.6.9-42.ELsmp_Depend/mozilla/layout/base/../../content/events/src -I/builds/tinderbox/Fx-Trunk-Debug/Linux_2.6.9-42.ELsmp_Depend/mozilla/layout/base/../../content/xbl/src -I/builds/tinderbox/Fx-Trunk-Debug/Linux_2.6.9-42.ELsmp_Depend/mozilla/layout/base/../../view/src -I/builds/tinderbox/Fx-Trunk-Debug/Linux_2.6.9-42.ELsmp_Depend/mozilla/layout/base/../../dom/src/base -I/builds/tinderbox/Fx-Trunk-Debug/Linux_2.6.9-42.ELsmp_Depend/mozilla/layout/base/../../content/svg/content/src -I/builds/tinderbox/Fx-Trunk-Debug/Linux_2.6.9-42.ELsmp_Depend/mozilla/layout/base/../mathml/content/src -I/builds/tinderbox/Fx-Trunk-Debug/Linux_2.6.9-42.ELsmp_Depend/mozilla/layout/base/../mathml/base/src -I/builds/tinderbox/Fx-Trunk-Debug/Linux_2.6.9-42.ELsmp_Depend/mozilla/layout/base/../svg/base/src -I../../dist/include/xpcom -I../../dist/include/string -I../../dist/include/dom -I../../dist/include/content -I../../dist/include/xul -I../../dist/include/xuldoc -I../../dist/include/gfx -I../../dist/include/widget -I../../dist/include/view -I../../dist/include/necko -I../../dist/include/docshell -I../../dist/include/webshell -I../../dist/include/webbrwsr -I../../dist/include/uriloader -I../../dist/include/js -I../../dist/include/xpconnect -I../../dist/include/plugin -I../../dist/include/locale -I../../dist/include/pref -I../../dist/include/imglib2 -I../../dist/include/unicharutil -I../../dist/include/htmlparser -I../../dist/include/util -I../../dist/include/windowwatcher -I../../dist/include/accessibility -I../../dist/include/shistory -I../../dist/include/caps -I../../dist/include/thebes -I../../dist/include/cairo -I../../dist/include -I../../dist/include/layout -I../../dist/include/nspr -DMOZ_PNG_READ -DMOZ_PNG_WRITE -I../../dist/sdk/include -I/usr/X11R6/include -fPIC -I/usr/X11R6/include -fno-rtti -fno-exceptions -Wall -Wconversion -Wpointer-arith -Wcast-align -Woverloaded-virtual -Wsynth -Wno-ctor-dtor-privacy -Wno-non-virtual-dtor -Wno-long-long -pedantic -fshort-wchar -pthread -pipe -DDEBUG -D_DEBUG -DDEBUG_cltbld -DTRACING -g -fno-inline -I../../dist/include/cairo -I/usr/X11R6/include -DMOZILLA_CLIENT -include ../../mozilla-config.h -Wp,-MD,.deps/nsPresShell.pp /builds/tinderbox/Fx-Trunk-Debug/Linux_2.6.9-42.ELsmp_Depend/mozilla/layout/base/nsPresShell.cpp
/builds/tinderbox/Fx-Trunk-Debug/Linux_2.6.9-42.ELsmp_Depend/mozilla/layout/base/nsPresShell.cpp: In member function ‘virtual nsresult PresShell::HandleEvent(nsIView*, nsGUIEvent*, nsEventStatus*)’:
/builds/tinderbox/Fx-Trunk-Debug/Linux_2.6.9-42.ELsmp_Depend/mozilla/layout/base/nsPresShell.cpp:5406: warning: comparison between signed and unsigned integer expressions
/builds/tinderbox/Fx-Trunk-Debug/Linux_2.6.9-42.ELsmp_Depend/mozilla/layout/base/nsPresShell.cpp: In function ‘PRBool CompareTrees(nsPresContext*, nsIFrame*, nsPresContext*, nsIFrame*)’:
/builds/tinderbox/Fx-Trunk-Debug/Linux_2.6.9-42.ELsmp_Depend/mozilla/layout/base/nsPresShell.cpp:6608: error: ‘struct nsBandTrapezoid’ has no member named ‘mFrame’
/builds/tinderbox/Fx-Trunk-Debug/Linux_2.6.9-42.ELsmp_Depend/mozilla/layout/base/nsPresShell.cpp:6608: error: ‘nsull’ was not declared in this scope
/builds/tinderbox/Fx-Trunk-Debug/Linux_2.6.9-42.ELsmp_Depend/mozilla/layout/base/nsPresShell.cpp:6608: error: ‘struct nsBandTrapezoid’ has no member named ‘mFrame’
/builds/tinderbox/Fx-Trunk-Debug/Linux_2.6.9-42.ELsmp_Depend/mozilla/layout/base/nsPresShell.cpp:6633: error: ‘struct nsBandTrapezoid’ has no member named ‘mFrame’
/builds/tinderbox/Fx-Trunk-Debug/Linux_2.6.9-42.ELsmp_Depend/mozilla/layout/base/nsPresShell.cpp:6633: error: ‘nsull’ was not declared in this scope
/builds/tinderbox/Fx-Trunk-Debug/Linux_2.6.9-42.ELsmp_Depend/mozilla/layout/base/nsPresShell.cpp:6633: error: ‘struct nsBandTrapezoid’ has no member named ‘mFrame’
I didn't feel comfortable enough with layout code to try and fix this myself.
Status: RESOLVED → REOPENED
Resolution: FIXED → ---
| Assignee | ||
Comment 23•18 years ago
|
||
Apparently the wrong was uploaded (two typo's which I correctly later).
I will create a new patch after updating my tree.
| Assignee | ||
Comment 24•18 years ago
|
||
Attachment #278215 -
Attachment is obsolete: true
| Assignee | ||
Comment 25•18 years ago
|
||
Who want to resubmit this to the tree?
Thanks in advance, Alfred
Keywords: checkin-needed
Comment 26•18 years ago
|
||
I think I get a build error with that latest patch (mingw debug build):
http://martijn.martijn.googlepages.com/builderror.txt
So I haven't checked it in yet.
| Assignee | ||
Comment 27•18 years ago
|
||
Replaced line 576:
NS_PRECONDITION(1 == aBandRect.mFrames.Count(), "shared band rect");
with
NS_PRECONDITION(1 == aBandRect->mFrames.Count(), "shared band rect");
Attachment #278623 -
Attachment is obsolete: true
Comment 28•18 years ago
|
||
Thanks, that one compiled just fine here.
Checking in generic/nsBlockBandData.cpp;
/cvsroot/mozilla/layout/generic/nsBlockBandData.cpp,v <-- nsBlockBandData.cpp
new revision: 1.55; previous revision: 1.54
done
Checking in generic/nsSpaceManager.cpp;
/cvsroot/mozilla/layout/generic/nsSpaceManager.cpp,v <-- nsSpaceManager.cpp
new revision: 3.85; previous revision: 3.84
done
Checking in generic/nsSpaceManager.h;
/cvsroot/mozilla/layout/generic/nsSpaceManager.h,v <-- nsSpaceManager.h
new revision: 3.52; previous revision: 3.51
done
Checking in base/nsPresShell.cpp;
/cvsroot/mozilla/layout/base/nsPresShell.cpp,v <-- nsPresShell.cpp
new revision: 3.1054; previous revision: 3.1053
done
Checked into trunk.
Status: REOPENED → RESOLVED
Closed: 18 years ago → 18 years ago
Resolution: --- → FIXED
Updated•18 years ago
|
Keywords: checkin-needed
| Assignee | ||
Comment 29•18 years ago
|
||
This saved a number of bytes in codesize, and no visible impact on other statistics, and the tests are OK.
libgklayout.so
Total: -624 (+412/-1036)
Code: -601 (+0/+0)
Data: -23 (+412/-1036)
Status: RESOLVED → VERIFIED
You need to log in
before you can comment on or make changes to this bug.
Description
•