Open Bug 1522863 Opened 7 years ago Updated 3 years ago

make compressall message replacement more efficient

Categories

(Core :: IPC, enhancement, P3)

enhancement

Tracking

()

People

(Reporter: froydnj, Unassigned)

Details

jld noted in bug 1520489 comment 7 that compressall determination is accidentally quadratic. I don't know if it's been observed as a problem, but it seems like that's not a good place to have a quadratic algorithm. We also only use compressall in one place currently, but it seems like we could use it in more places.

Instead of scanning the entire pending queue, what we ought to be able to do is:

  1. Get the IPDL compiler to emit a table with one entry for every compressall message type. Also provide some mapping function from a message type to its corresponding slot in the table.
  2. When we insert a compressall message, there are two cases that we need to check:
    a) The table slot is empty, and we should store a reference to the message in the table.
    b) The table slot is occupied, and we should remove the current occupant from the queue, and set the slot to the new message.
  3. We now also have to clear the appropriate slot when messages are removed from the queue.

Step 2 corresponds to what we're doing now, but is independent of the number of messages in the queue, which should have better worse-case behavior.

Priority: -- → P3
Severity: normal → S3
You need to log in before you can comment on or make changes to this bug.