Closed Bug 1186787 Opened 9 years ago Closed 9 years ago

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

Categories

(Core :: General, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla45
Tracking Status
firefox45 --- fixed

People

(Reporter: n.nethercote, Assigned: n.nethercote)

References

Details

Attachments

(2 files)

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: nobody → n.nethercote
Status: NEW → ASSIGNED
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+
> 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...
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.
https://hg.mozilla.org/mozilla-central/rev/401949c4008e
https://hg.mozilla.org/mozilla-central/rev/4e0a66f7b693
Status: ASSIGNED → RESOLVED
Closed: 9 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla45
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: