Closed
Bug 1361392
Opened 8 years ago
Closed 8 years ago
Inefficient memory use in gfxHarfBuzzShaper::ShapeText
Categories
(Core :: Graphics: Text, defect)
Core
Graphics: Text
Tracking
()
RESOLVED
FIXED
mozilla55
Tracking | Status | |
---|---|---|
firefox55 | --- | fixed |
People
(Reporter: jseward, Assigned: jfkthame)
Details
Attachments
(2 files)
(deleted),
text/plain
|
Details | |
(deleted),
patch
|
jrmuizel
:
review+
|
Details | Diff | Splinter Review |
Setup, STR, etc, exactly as with bug 1361372.
DHAT says we allocate 9138 blocks via
gfxHarfBuzzShaper::ShapeText
hb_buffer_add_utf16
hb_buffer_add_utf
ensure
hb_buffer_t::enlarge
realloc
malloc
always of size 640. Averaged over all allocations, each byte is written
0.40 times and read only 0.18 times. From the log (see attachment) there
are no uses at offset 560 or after in any block, and almost no uses after
the halfway point (offset 320).
Reporter | ||
Comment 1•8 years ago
|
||
Assignee | ||
Comment 2•8 years ago
|
||
This sounds pretty reasonable, actually, given that we're normally shaping an individual (fairly short) word, but harfbuzz can't know this; so it allocates space for glyph details and position data in 32-char increments (IIRC). Usually, we only use the first few characters' worth of that space.
I suppose we could optimize slightly, though, by caching the hb_buffer record in gfxHarfBuzzShaper and just clearing its contents, instead of discarding the buffer and creating a new one for each ShapeText call.
Assignee | ||
Comment 3•8 years ago
|
||
This should eliminate three malloc/free operations (the buffer itself, and its internal 'info' and 'pos' arrays) per ShapeText call, in general.
Attachment #8863794 -
Flags: review?(jmuizelaar)
Assignee | ||
Updated•8 years ago
|
Assignee: nobody → jfkthame
Status: NEW → ASSIGNED
Updated•8 years ago
|
Attachment #8863794 -
Flags: review?(jmuizelaar) → review+
Assignee | ||
Comment 4•8 years ago
|
||
https://hg.mozilla.org/integration/mozilla-inbound/rev/eee394a4575b6caf23b820c930059bf994ea228d
Bug 1361392 - Re-use the hb_buffer in gfxHarfBuzzShaper instead of creating/destroying it on each call to ShapeText. r=jrmuizel
Backed out for causing asan mochitests to leak like https://treeherder.mozilla.org/logviewer.html#?job_id=97011198&repo=mozilla-inbound
Flags: needinfo?(jfkthame)
Also in valgrind builds https://treeherder.mozilla.org/logviewer.html#?job_id=97012345&repo=mozilla-inbound
Backout by kwierso@gmail.com:
https://hg.mozilla.org/integration/mozilla-inbound/rev/21a512c16cf8
Backed out changeset eee394a4575b for leaksanitizer failures in pretty much all ASAN mochitests a=backout
Assignee | ||
Comment 8•8 years ago
|
||
Sorry -- I messed up when rebasing the patch to inbound tip. :( Fixed version coming....
Flags: needinfo?(jfkthame)
Assignee | ||
Comment 9•8 years ago
|
||
https://hg.mozilla.org/integration/mozilla-inbound/rev/22c2c450b41e59198d38aa9936072de43ab77703
Bug 1361392 - Re-use the hb_buffer in gfxHarfBuzzShaper instead of creating/destroying it on each call to ShapeText. r=jrmuizel
Comment 10•8 years ago
|
||
Pushed by jkew@mozilla.com:
https://hg.mozilla.org/integration/mozilla-inbound/rev/22c2c450b41e
Re-use the hb_buffer in gfxHarfBuzzShaper instead of creating/destroying it on each call to ShapeText. r=jrmuizel
Comment 11•8 years ago
|
||
bugherder |
Status: ASSIGNED → RESOLVED
Closed: 8 years ago
status-firefox55:
--- → fixed
Resolution: --- → FIXED
Target Milestone: --- → mozilla55
You need to log in
before you can comment on or make changes to this bug.
Description
•