Last Comment Bug 616941 - Consider short strings for String.prototype.substring results
: Consider short strings for String.prototype.substring results
Status: NEW
Product: Core
Classification: Components
Component: JavaScript Engine (show other bugs)
: unspecified
: x86_64 Linux
-- normal with 3 votes (vote)
: ---
Assigned To: Nobody; OK to take it and work on it
: Jason Orendorff [:jorendorff]
: 617148 (view as bug list)
Depends on:
  Show dependency treegraph
Reported: 2010-12-06 02:09 PST by Igor Bukanov
Modified: 2014-07-24 11:07 PDT (History)
5 users (show)
See Also:
Crash Signature:
QA Whiteboard:
Iteration: ---
Points: ---
Has Regression Range: ---
Has STR: ---


Description User image Igor Bukanov 2010-12-06 02:09:10 PST
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.
Comment 1 User image Nicholas Nethercote [:njn] 2010-12-06 14:43:41 PST
*** Bug 617148 has been marked as a duplicate of this bug. ***

Note You need to log in before you can comment on or make changes to this bug.