Closed Bug 1879800 Opened 8 months ago Closed 8 months ago

Optimize WalkMemoryCacheRunnable's use of nsTArray

Categories

(Core :: Networking: Cache, task, P2)

task

Tracking

()

RESOLVED FIXED
124 Branch
Tracking Status
firefox124 --- fixed

People

(Reporter: jstutte, Assigned: jstutte)

References

Details

(Whiteboard: [necko-triaged])

Attachments

(1 file)

WalkMemoryCacheRunnable stores a list of cache entries to then walk through it and do mEntryArray.RemoveElementAt(0); on each iteration. This causes unnecessary memcpy operations on the array and during filling and on some iterations eventually also reallocs. We should ensure, that:

  • the memory is allocated only once at the beginning for the entire set
  • we keep an index for the last run iteration, just nulling out the RefPtr without removing the element
  • the memory is freed only once at the very end of WalkMemoryCacheRunnable's lifetime
See Also: → 1875859
Assignee: nobody → jstutte
Status: NEW → ASSIGNED
Severity: -- → N/A
Priority: -- → P2
Whiteboard: [necko-triaged]
Pushed by jstutte@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/0b0f24bc9a21 Avoid WalkMemoryCacheRunnable::mEntryArray to be shifted on each iteration. r=necko-reviewers,valentin
Status: ASSIGNED → RESOLVED
Closed: 8 months ago
Resolution: --- → FIXED
Target Milestone: --- → 124 Branch
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: