Closed
Bug 243250
Opened 21 years ago
Closed 21 years ago
reduce size of nsStandardURL
Categories
(Core :: Networking, defect)
Core
Networking
Tracking
()
VERIFIED
FIXED
mozilla1.8alpha1
People
(Reporter: darin.moz, Assigned: darin.moz)
Details
Attachments
(1 file, 1 obsolete file)
4.34 KB,
patch
|
Biesinger
:
review+
bzbarsky
:
superreview+
|
Details | Diff | Splinter Review |
nsStandardURL has a bunch of member variables that can each be represented by a
single bit or only a few bits each. these should probably be combined into a
single PRUint32 to help reduce the size of nsStandardURL.
the member variables i'm thinking of include:
mURLType
mHostEncoding
mSpecEncoding
mMutable
mSupportsFileURL
we could probably also pack mDefaultPort and mPort together.
these are easy things that we can do to reduce the size of nsStandardURL. it's
also the case that there is some redundancy with the URLSegment member
variables. many of these could be inferred from other values, so we could
probably save space by not storing all of these. however, that's a much more
involved change. this bug should just be able combining the fields i mentioned
above, which should save about 20 bytes per nsStandardURL.
Assignee | ||
Comment 1•21 years ago
|
||
...this bug should just be *about* combining...
Assignee | ||
Updated•21 years ago
|
Severity: normal → minor
Status: NEW → ASSIGNED
Target Milestone: --- → mozilla1.8alpha
Assignee | ||
Comment 2•21 years ago
|
||
actually, i wasn't thinking when i said that combining those members would save
20 bytes. two of those members are PRPackedBool, and as for the port numbers...
-1 has significance, and so we'd need at least 17 bits to represent a port
properly. we could do that with a PRUint16 plus a bit field, but then we'd be
checking the bit field before using the port value.
at any rate, it was easy enough to combine:
mURLType
mHostEncoding
mSpecEncoding
mMutable
mSupportsFileURL
all into one PRUint32 by using bit-fields. the patch is trivial.
Assignee | ||
Comment 3•21 years ago
|
||
Assignee | ||
Comment 4•21 years ago
|
||
with better comment.
Attachment #148175 -
Attachment is obsolete: true
Assignee | ||
Comment 5•21 years ago
|
||
Comment on attachment 148176 [details] [diff] [review]
v1.1 patch
hey boris, this is a trivial one to review. if you really don't have time then
no problem... just let me know. i just figured i'd ask you since you brought
up the performance impact of nsStandardURL today :-)
Attachment #148176 -
Flags: superreview?(bzbarsky)
Attachment #148176 -
Flags: review?(cbiesinger)
Comment 6•21 years ago
|
||
Comment on attachment 148176 [details] [diff] [review]
v1.1 patch
+ PRUint32 mHostEncoding : 2; // eEncoding_xxx
hm... can you not use:
nsEncodingType mHostEncoding : 2; ? that would be clearer, I think...
r=me either way
Attachment #148176 -
Flags: review?(cbiesinger) → review+
![]() |
||
Comment 7•21 years ago
|
||
Comment on attachment 148176 [details] [diff] [review]
v1.1 patch
sr=bzbarsky
Attachment #148176 -
Flags: superreview?(bzbarsky) → superreview+
Assignee | ||
Comment 8•21 years ago
|
||
> hm... can you not use:
> nsEncodingType mHostEncoding : 2; ? that would be clearer, I think...
I double check, but I think the last time I tried to do that I got an error or
warning from the compiler.
Assignee | ||
Comment 9•21 years ago
|
||
so, GCC 3.x doesn't have a problem with bitfields on an enum type. not sure
what i was thinking....
Assignee | ||
Comment 10•21 years ago
|
||
bah, i like the idea that all of the bit fields use the same principle type name.
it makes the fields all line up, which has visual appeal, and doesn't require
someone to figure out that nsEncodingType is just an integer. the other fields
like mURLType also take enumeration values, but we don't have an enumeration
type for it. in short i prefer the patch as is ;-)
Assignee | ||
Comment 11•21 years ago
|
||
fixed-on-trunk
Status: ASSIGNED → RESOLVED
Closed: 21 years ago
Resolution: --- → FIXED
Comment 12•21 years ago
|
||
for .cpp:
1.62darin%meer.net2004-05-11 11:58 fixes bug 243250 "reduce size of
nsStandardURL" r=biesi sr=bzbarsky
for .h:
1.19darin%meer.net2004-05-11 11:58 fixes bug 243250 "reduce size of
nsStandardURL" r=biesi sr=bzbarsky
Status: RESOLVED → VERIFIED
You need to log in
before you can comment on or make changes to this bug.
Description
•