Open
Bug 1297805
Opened 9 years ago
Updated 3 years ago
avoid array bounds checking in nsTArray methods
Categories
(Core :: XPCOM, defect, P3)
Core
XPCOM
Tracking
()
NEW
People
(Reporter: froydnj, Unassigned)
Details
Attachments
(1 file)
1.87 KB,
patch
|
erahm
:
review+
|
Details | Diff | Splinter Review |
There are a few places in nsTArray where we know exactly how many
elements we're operating on, so we can avoid the bounds-checked
operator[] methods and use direct pointer accesses instead, which saves
space and time.avoid array bounds checking in nsTArray methods; r=erahm
![]() |
Reporter | |
Comment 1•9 years ago
|
||
Attachment #8784524 -
Flags: review?(erahm)
Comment 2•9 years ago
|
||
Comment on attachment 8784524 [details] [diff] [review]
avoid array bounds checking in nsTArray methods
Review of attachment 8784524 [details] [diff] [review]:
-----------------------------------------------------------------
::: xpcom/glue/nsTArray.h
@@ +2097,5 @@
> const char* aName,
> uint32_t aFlags = 0)
> {
> aFlags |= CycleCollectionEdgeNameArrayFlag;
> size_t length = aField.Length();
You can get rid of |length|.
Attachment #8784524 -
Flags: review?(erahm) → review+
Comment 3•8 years ago
|
||
Comment on attachment 8784524 [details] [diff] [review]
avoid array bounds checking in nsTArray methods
Review of attachment 8784524 [details] [diff] [review]:
-----------------------------------------------------------------
Hey Nathan, found this old review hanging around. Do you still want to land it?
::: xpcom/glue/nsTArray.h
@@ +2099,5 @@
> {
> aFlags |= CycleCollectionEdgeNameArrayFlag;
> size_t length = aField.Length();
> + for (auto& elem : aField) {
> + ImplCycleCollectionTraverse(aCallback, elem, aName, aFlags);
Our iterator does bounds checking now, so this isn't really a win in this form.
Updated•8 years ago
|
Flags: needinfo?(nfroyd)
![]() |
Reporter | |
Comment 4•8 years ago
|
||
Landing it would probably be good. Do you have any objection to me making the obvious Elements()-related change to the cycle collection hook, since our iterators bounds-check now?
Flags: needinfo?(nfroyd)
Comment 5•8 years ago
|
||
(In reply to Nathan Froyd [:froydnj] from comment #4)
> Landing it would probably be good. Do you have any objection to me making
> the obvious Elements()-related change to the cycle collection hook, since
> our iterators bounds-check now?
r=me
![]() |
Reporter | |
Updated•8 years ago
|
Priority: -- → P3
Comment 6•3 years ago
|
||
The bug assignee didn't login in Bugzilla in the last 7 months, so the assignee is being reset.
Assignee: froydnj+bz → nobody
Comment 7•3 years ago
|
||
Patch still looks relevant FWIW.
Updated•3 years ago
|
Severity: normal → S3
You need to log in
before you can comment on or make changes to this bug.
Description
•