Closed Bug 558962 Opened 11 years ago Closed 11 years ago

Memoize nsPlaintextEditor::GetDefaultEditorPrefs to avoid unnecessary calls to the pref service

Categories

(Core :: DOM: Editor, defect)

x86
All
defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla1.9.3a5

People

(Reporter: ehsan, Assigned: ehsan)

References

Details

(Keywords: perf)

Attachments

(1 file)

Attached patch Patch (v1)Splinter Review
Currently, nsPlaintextEditor::GetDefaultEditorPrefs calls into the pref service each time it's called.  As it turns out, this call is made at least once if you set the value on an input text control, which is really inefficient.  We can listen for changes on that pref, and only update them when necessary.
Attachment #438639 - Flags: review?(roc)
Comment on attachment 438639 [details] [diff] [review]
Patch (v1)

+static
+int

one line

+  if (sNewlineHandlingPref == -1 && sCaretStylePref == -1) {

Just check one of them
Attachment #438639 - Flags: review?(roc) → review+
OS: Mac OS X → All
Summary: Memoize nsPlaintextEditor::GetDefaultEditorPrefs to avoid unnecessary calls to the pref service → Memorize nsPlaintextEditor::GetDefaultEditorPrefs to avoid unnecessary calls to the pref service
http://hg.mozilla.org/mozilla-central/rev/0bdaacb280d4
Status: ASSIGNED → RESOLVED
Closed: 11 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla1.9.3a5
The bug title wasn't a typo!  :-)

http://en.wikipedia.org/wiki/Memoization
Summary: Memorize nsPlaintextEditor::GetDefaultEditorPrefs to avoid unnecessary calls to the pref service → Memoize nsPlaintextEditor::GetDefaultEditorPrefs to avoid unnecessary calls to the pref service
You need to log in before you can comment on or make changes to this bug.