Closed Bug 1096487 Opened 10 years ago Closed 10 years ago

make ipdl message creation marginally more efficient

Categories

(Core :: IPC, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla36

People

(Reporter: froydnj, Assigned: froydnj)

Details

Attachments

(3 files)

We do double work during ipdl message creation:

- We initialize fields with the constructor;
- We re-initialize some fields with Message::set_* calls after that.

We should just let the constructor do as much of the work as it can.  We could
make the flag setting of set_{sync,interrupt,reply} more efficient, but that
would require poking through some abstraction boundaries.
The default constructor for ipdl-generated messages looks like:

    MOZ_IMPLICIT Msg_AsyncMessage() :
        IPC::Message(MSG_ROUTING_NONE, ID, IPC::Message::PRIORITY_NORMAL, COMPRESSION_NONE, "PContent::Msg_AsyncMessage")
    {
    }

IPC::Message::PRIORITY_NORMAL is 1, so any set_priority(1) calls are
just redudant.

Additionally, the priorities for messages are known at code generation
time, so we are always able to provide the right constants to the
message constructor, rather than using set_priority calls later.
Attachment #8520071 - Flags: review?(bent.mozilla)
Similarly to part, there's no need to say we don't know the routing id
when constructing a message, and then turn around and set the routing id
immediately afterwards.  Just let the constructor do its work.
Attachment #8520072 - Flags: review?(bent.mozilla)
This isn't really a patch, just a diff showing what happens to codegen once you apply the patches.
Attachment #8520076 - Flags: feedback?(bent.mozilla)
Attachment #8520071 - Flags: review?(bent.mozilla) → review+
Attachment #8520076 - Flags: feedback?(bent.mozilla) → feedback+
Comment on attachment 8520072 [details] [diff] [review]
part 2 - make ipdl message constructors take their routing id

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

Thanks!
Attachment #8520072 - Flags: review?(bent.mozilla) → review+
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: