Closed
Bug 1344503
Opened 8 years ago
Closed 10 months ago
fitzgen.github.io/bugzilla-todos/ results in hundreds of thousands of copies of the same string
Categories
(Core :: JavaScript Engine, defect, P3)
Core
JavaScript Engine
Tracking
()
RESOLVED
INCOMPLETE
Tracking | Status | |
---|---|---|
firefox54 | --- | affected |
People
(Reporter: jwatt, Unassigned)
References
Details
(Keywords: triage-deferred)
Attachments
(1 file)
11.34 KB,
text/plain
|
Details |
After having Firefox open for several days, about:memory reported that the window using the most memory was https://fitzgen.github.io/bugzilla-todos/ . I first clicked "Minimize memory usage" then "Measure" with "verbose" checked. What seems strange is that about:memory reports that there are hundreds of thousands of copies of the same strings. I'm not sure if the JS engine is expected to optimize these away, or if this is simply the fault of the Web site.
Comment 1•8 years ago
|
||
My understanding is we de-dupe small strings (2 chars and less), but not all strings.
Comment 2•8 years ago
|
||
(In reply to Jonathan Watt [:jwatt] from comment #0)
> I'm not sure if the JS
> engine is expected to optimize these away, or if this is simply the fault of
> the Web site.
It depends on how the website is creating these strings. Atoms are strings that have the invariant there's a single copy for the entire runtime, but there are lots of ways to create duplicate non-atomized strings. Sometimes we can avoid that but deduplicating all strings we allocate would add way too much overhead.
So we need to know what the website is doing and then we can figure out if there's a way to avoid the copies.
![]() |
Reporter | |
Comment 3•8 years ago
|
||
(In reply to Ben Kelly [not reviewing due to deadline][:bkelly] from comment #1)
> My understanding is we de-dupe small strings (2 chars and less), but not all
> strings.
From the attached about:memory snapshot, there is at least one length=2 string ("%d", with 61001 copies):
├──31,907,504 B (01.41%) -- strings
│ ├───3,677,216 B (00.16%) ── string(length=7, copies=153214, "getData")/gc-heap/latin1
│ ├───3,677,184 B (00.16%) ── string(length=5, copies=153216, "#TEXT")/gc-heap/two-byte
│ ├───3,677,136 B (00.16%) ── string(length=4, copies=153214, "span")/gc-heap/two-byte
│ ├───3,677,136 B (00.16%) ── string(length=8, copies=153214, "getData!")/gc-heap/latin1
│ ├───1,851,360 B (00.08%) -- string(length=4, copies=77140, "SPAN")/gc-heap
│ ├───1,838,592 B (00.08%) ── string(length=13, copies=76608, "[object Text]")/gc-heap/latin1
│ ├───1,838,592 B (00.08%) ── string(length=5, copies=76608, "#text")/gc-heap/two-byte
│ ├───1,838,592 B (00.08%) ── string(length=6, copies=76608, "SCRIPT")/gc-heap/latin1
│ ├───1,464,024 B (00.06%) ── string(length=2, copies=61001, "%d")/gc-heap/latin1
Comment 4•8 years ago
|
||
Maybe we should de-duplicate strings when we do a shrinking GC.
Updated•7 years ago
|
Keywords: triage-deferred
Priority: -- → P3
Updated•2 years ago
|
Severity: normal → S3
Comment 5•10 months ago
|
||
We do some deduplication these days.
Status: NEW → RESOLVED
Closed: 10 months ago
Resolution: --- → INCOMPLETE
You need to log in
before you can comment on or make changes to this bug.
Description
•