Consider short strings for String.prototype.substring results

RESOLVED FIXED

Status

()

defect
RESOLVED FIXED
9 years ago
10 months ago

People

(Reporter: igor, Unassigned)

Tracking

Firefox Tracking Flags

(Not tracked)

Details

Reporter

Description

9 years ago
Currently str_substring implementing String.prototype.substring always creates dependent strings even if the result fits the short string. Although the short strings do take more memory using them would avoid flattening of the base string if it is a rope. Another advantage of the short string is that it does not prevent the base string from the GC.

So even if using short strings unconditionally may slow things down we should consider using them even if the base string is a rope or a likely to be short-lived based, for example, on a length heuristics.
Duplicate of this bug: 617148
Assignee: general → nobody

Comment 2

10 months ago
This eventually tunnels into JSDependentString::new_ now, and that function implements the inline optimization, so this is fixed.
Status: NEW → RESOLVED
Closed: 10 months ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.