Closed Bug 1385538 Opened 7 years ago Closed 7 years ago

EditorBase::BeginPlaceHolderTransaction() is malloc heavy

Categories

(Core :: DOM: Editor, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla56
Tracking Status
firefox56 --- fixed

People

(Reporter: ehsan.akhgari, Assigned: ehsan.akhgari)

References

(Blocks 1 open bug)

Details

Attachments

(1 file)

The malloc as far as I can tell comes from EditorBase::mSelState, which uses UniquePtr.

UniquePtr is unfortunately an inefficient smart pointer, it encourages the programmer to dynamically allocate.  Here, dynamic allocation isn't needed at all, the object is quite small, what's needed is dynamic lifetime management.  That can be done much more efficiently with Maybe, which has inline storage.
Comment on attachment 8891605 [details] [diff] [review]
Avoid dynamic memory allocation for EditorBase::mSelState

Really interesting.
Attachment #8891605 - Flags: review?(masayuki) → review+
Pushed by eakhgari@mozilla.com:
https://hg.mozilla.org/integration/mozilla-inbound/rev/30a16b6553d7
Avoid dynamic memory allocation for EditorBase::mSelState; r=masayuki
https://hg.mozilla.org/mozilla-central/rev/30a16b6553d7
Status: NEW → RESOLVED
Closed: 7 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla56
Depends on: 1388917
Assignee: nobody → ehsan
You need to log in before you can comment on or make changes to this bug.