Replace nsBaseHashtable::EnumerateRead() calls in chrome/ with iterators

RESOLVED FIXED in Firefox 45

Status

()

RESOLVED FIXED
3 years ago
3 years ago

People

(Reporter: njn, Assigned: njn)

Tracking

unspecified
mozilla45
Points:
---

Firefox Tracking Flags

(firefox45 fixed)

Details

Attachments

(2 attachments)

(Assignee)

Description

3 years ago
Because iterators are so much nicer than enumerate functions.

There are two occurrences of EnumerateRead() in this directory.

A note to the assignee: to preserve existing behaviour, you should probably use
nsBaseHashtable::Iterator::UserData() rather than nsBaseHashtable::Iterator::Data(). (The latter should be used when replacing nsBaseHashtable::Enumerate()).
(Assignee)

Comment 1

3 years ago
Created attachment 8688252 [details] [diff] [review]
(part 1) - Replace nsBaseHashtable::EnumerateRead() calls in chrome/ with iterators
Attachment #8688252 - Flags: review?(nfroyd)
(Assignee)

Updated

3 years ago
Assignee: nobody → n.nethercote
Status: NEW → ASSIGNED
(Assignee)

Comment 2

3 years ago
Created attachment 8688253 [details] [diff] [review]
(part 2) - Replace nsBaseHashtable::EnumerateRead() calls in chrome/ with iterators
Attachment #8688253 - Flags: review?(nfroyd)
Attachment #8688252 - Flags: review?(nfroyd) → review+
Comment on attachment 8688253 [details] [diff] [review]
(part 2) - Replace nsBaseHashtable::EnumerateRead() calls in chrome/ with iterators

Review of attachment 8688253 [details] [diff] [review]:
-----------------------------------------------------------------

I wonder how much better things would be if we did:

  OverrideMapping* om = $.AppendElement();
  SerializeURI(..., om->originalURI);
  SerializeURI(..., om->overrideURI);

Not asking you to do this, just wondering about the micro-optimization.

Alternatively, for micro-optimizations, you could:

  OverrideMapping* omptr = $.AppendElements(mOverrideTable.Count());
  for (...) {
    SerializeURI(..., omptr->...);
    omptr++;
  }

Maybe all these micro-optimizations should be a separate bug. :)
Attachment #8688253 - Flags: review?(nfroyd) → review+
(Assignee)

Comment 4

3 years ago
> Maybe all these micro-optimizations should be a separate bug. :)

Feel free to file one :)  Measurements showing this code is hot would be a useful accompaniment; I suspect it's not but I've been wrong before...
(Assignee)

Comment 5

3 years ago
https://hg.mozilla.org/integration/mozilla-inbound/rev/401949c4008ed49464a7fd13781bee79b432a0b4
Bug 1186787 (part 1) - Replace nsBaseHashtable::EnumerateRead() calls in chrome/ with iterators. r=froydnj.

https://hg.mozilla.org/integration/mozilla-inbound/rev/4e0a66f7b693d055ef52c5b17d55cb117d6296b0
Bug 1186787 (part 2) - Replace nsBaseHashtable::EnumerateRead() calls in chrome/ with iterators. r=froydnj.

Comment 6

3 years ago
bugherder
https://hg.mozilla.org/mozilla-central/rev/401949c4008e
https://hg.mozilla.org/mozilla-central/rev/4e0a66f7b693
Status: ASSIGNED → RESOLVED
Last Resolved: 3 years ago
status-firefox45: --- → fixed
Resolution: --- → FIXED
Target Milestone: --- → mozilla45
You need to log in before you can comment on or make changes to this bug.