Closed
Bug 1442433
Opened 8 years ago
Closed 8 years ago
Remove the refcount from static and HTML5 atoms
Categories
(Core :: XPCOM, enhancement)
Core
XPCOM
Tracking
()
RESOLVED
FIXED
mozilla60
| Tracking | Status | |
|---|---|---|
| firefox60 | --- | fixed |
People
(Reporter: n.nethercote, Assigned: n.nethercote)
References
(Blocks 2 open bugs)
Details
Attachments
(4 files)
|
8.47 KB,
patch
|
froydnj
:
review+
|
Details | Diff | Splinter Review |
|
1.97 KB,
patch
|
froydnj
:
review+
|
Details | Diff | Splinter Review |
|
6.39 KB,
patch
|
froydnj
:
review+
|
Details | Diff | Splinter Review |
|
2.03 KB,
patch
|
froydnj
:
review+
|
Details | Diff | Splinter Review |
The refcount is only used for dynamic atoms.
On 64-bit, this reduces sizeof(nsStaticAtom) from 24 bytes to 16 bytes, and the
corresponding heap allocation from 32 bytes to 16 bytes. This saves 42 KiB per
process.
On 32-bit, this reduces sizeof(nsStaticAtom) from 16 bytes to 12 bytes, but the
corresponding heap allocated stays at 16 bytes, so memory usage is unchanged.
The change will also reduce the size of HTML5 atoms, but they are short-lived
so the difference won't be noticeable.
MozReview-Commit-ID: 7d9H7MRHN9a
| Assignee | ||
Comment 1•8 years ago
|
||
Attachment #8955334 -
Flags: review?(nfroyd)
| Assignee | ||
Comment 2•8 years ago
|
||
Also remove the unused SetKind() method.
MozReview-Commit-ID: CIh6BmN7OLI
Attachment #8955409 -
Flags: review?(nfroyd)
Comment 3•8 years ago
|
||
Comment on attachment 8955334 [details] [diff] [review]
Remove the refcount from static atoms
Review of attachment 8955334 [details] [diff] [review]:
-----------------------------------------------------------------
So easy.
Attachment #8955334 -
Flags: review?(nfroyd) → review+
Comment 4•8 years ago
|
||
Comment on attachment 8955409 [details] [diff] [review]
Make some nsAtom fields `const`
Review of attachment 8955409 [details] [diff] [review]:
-----------------------------------------------------------------
\o/
Attachment #8955409 -
Flags: review?(nfroyd) → review+
| Assignee | ||
Comment 5•8 years ago
|
||
The patch also uses GetStringBuffer() in a couple of appropriate places.
MozReview-Commit-ID: JufCUgmO8JL
Attachment #8955951 -
Flags: review?(nfroyd)
| Assignee | ||
Comment 6•8 years ago
|
||
I'm a bit ambivalent about this one. What do you think?
Attachment #8955967 -
Flags: review?(nfroyd)
Updated•8 years ago
|
Attachment #8955951 -
Flags: review?(nfroyd) → review+
Comment 7•8 years ago
|
||
Comment on attachment 8955967 [details] [diff] [review]
Make nsAtom::mString even more const
Review of attachment 8955967 [details] [diff] [review]:
-----------------------------------------------------------------
I think the idea is reasonable, even if the const_cast is ugly.
I wonder if we could push the constness farther, by:
1) making nsStringBuffer::FromData take `const void*`. We'd still have to const_cast, but I think it's a little more justified inside FromData than elsewhere; and/or
2) making nsStringBuffer more const itself--mStorageSize should be const, as should the canary (I think). We'd have to mark the refcnt `mutable`, but I think that's OK (see ConstRemovingRefPtrTraits in RefPtr.h for a discussion of the issues).
Both of those (especially #2) are followups, of course.
I think the patch improves the state of the world.
Attachment #8955967 -
Flags: review?(nfroyd) → review+
| Assignee | ||
Comment 8•8 years ago
|
||
https://hg.mozilla.org/integration/mozilla-inbound/rev/7e4bac75138f31d2c66a9ef2a235b4303c573b0c
Bug 1442433 - Remove the refcount from static atoms. r=froydnj
https://hg.mozilla.org/integration/mozilla-inbound/rev/786c4905fe76d92f6f45cdce39ea4eb1228791b9
Bug 1442433 - Make some nsAtom fields `const`. r=froydnj
https://hg.mozilla.org/integration/mozilla-inbound/rev/06e62ae8e4cc238cd75c69fa55997d28562ccf76
Bug 1442433 - Make nsAtom::mString more const. r=froydnj
https://hg.mozilla.org/integration/mozilla-inbound/rev/ca86b5f0a30a71d0e57e829176bd1eb611d8c2a1
Bug 1442433 - Make nsAtom::mString even more const. r=froydnj
Comment 9•8 years ago
|
||
| bugherder | ||
https://hg.mozilla.org/mozilla-central/rev/7e4bac75138f
https://hg.mozilla.org/mozilla-central/rev/786c4905fe76
https://hg.mozilla.org/mozilla-central/rev/06e62ae8e4cc
https://hg.mozilla.org/mozilla-central/rev/ca86b5f0a30a
Status: ASSIGNED → RESOLVED
Closed: 8 years ago
status-firefox60:
--- → fixed
Resolution: --- → FIXED
Target Milestone: --- → mozilla60
You need to log in
before you can comment on or make changes to this bug.
Description
•