Closed
Bug 201782
Opened 21 years ago
Closed 8 years ago
Reduce NS_LITERAL_STRING usage in editor to reduce code size
Categories
(Core :: DOM: Editor, defect)
Core
DOM: Editor
Tracking
()
RESOLVED
INCOMPLETE
People
(Reporter: sfraser_bugs, Unassigned)
Details
(Keywords: memory-footprint, Whiteboard: editorbase-)
Attachments
(3 files)
18.91 KB,
patch
|
Details | Diff | Splinter Review | |
6.17 KB,
text/plain
|
Details | |
70.20 KB,
patch
|
Details | Diff | Splinter Review |
nsAString::Equals(NS_LITERAL_STRING("foo")) produces very verbose code. Converting to narrow (UTF8) strings and comparing with a literal C string shrinks the code considerably (see attached data). Since we're only ever concerned with attribute names in ASCII in editor, maybe we should consider converting all attribute strings to 8-bit.
Reporter | ||
Comment 1•21 years ago
|
||
Reporter | ||
Comment 2•21 years ago
|
||
Numbers on the left are compiled size of this method in bytes. Diff shows function size before, and after the patch. For example: - 6652 t nsHTMLEditRules::RemoveBlockStyle(nsCOMArray<nsIDOMNode>&) + 2088 t nsHTMLEditRules::RemoveBlockStyle(nsCOMArray<nsIDOMNode>&) - 5476 t nsHTMLEditRules::ApplyBlockStyle(nsCOMArray<nsIDOMNode>&, nsAString const*) + 2476 t nsHTMLEditRules::ApplyBlockStyle(nsCOMArray<nsIDOMNode>&, nsAString const*) Effects of these changes on library size in an opt build: -rwxr-xr-x 1 smfr staff 880004 Apr 12 10:43 libeditor_patched.dylib -rwxr-xr-x 1 smfr staff 895532 Apr 12 10:11 libeditor_original.dylib
Reporter | ||
Comment 3•21 years ago
|
||
This patch contains more cleanup, not just related to string usage. Changes include: * Make data const where possible * More efficient member var packing (PRPackedBool) * Tidy up ctor member intialization to fix warnings * Remove unused static gInstanceCounts * Clean up nsEditor::GetTextNodeTag (what was buster thinking??) * Removed the sParserService static in nsHTMLEditor. This had knock-on effects of making a bunch of methods non-static, which percolates into the nsHTMLEditRules and nsWSRunObject. NodeIsBlockStatic was removed. Lib size with these changes: -rwxr-xr-x 1 smfr staff 895532 Apr 12 10:11 libeditor_orig.dylib -rwxr-xr-x 1 smfr staff 873924 Apr 12 14:40 libeditor_patched.dylib
Updated•21 years ago
|
Whiteboard: editorbase
Comment 4•21 years ago
|
||
editorbase- -> sfraser
Comment 5•19 years ago
|
||
Simon do you intend to update/check these patches in ?
Updated•17 years ago
|
QA Contact: editor
Updated•17 years ago
|
Assignee: mozeditor → nobody
Comment 7•8 years ago
|
||
The Equals(NS_LITERAL_*(...)) changes are no longer relevant, and editor/ has changed so much in the past decade or so that the size patches are probably irrelevant as well.
Status: NEW → RESOLVED
Closed: 8 years ago
Resolution: --- → INCOMPLETE
You need to log in
before you can comment on or make changes to this bug.
Description
•