Closed Bug 551110 Opened 14 years ago Closed 14 years ago

Should we special-case length-1 strings? If so, where?

Categories

(Core :: JavaScript Engine, defect)

x86
macOS
defect
Not set
normal

Tracking

()

RESOLVED FIXED

People

(Reporter: bzbarsky, Unassigned)

Details

We may be able to use unitStringTable or just length-checks to optimize various operations (e.g. js_StringToNumber) for unit strings.  jsc does this; see https://bugs.webkit.org/show_bug.cgi?id=20333

It looks like js_EqualStrings doesn't use memcmp anyway, but we could maybe add a fast-path to js_StringToNumber if bug 551109 doesn't help enough.  Worth measuring on the string-base64 test to see where we spend time.
Blocks: 551039
Note that we already have something like this special case in js_StringToInt32.  We don't have it in js_ValueToNumber, though, or js_StringToNumber.
That happened in bug 514267, apparently.
No longer blocks: 551039
I tried it last summer for string concatenation. There is a benchmark in SS that creates a huge string by just adding one character at the end all the time.
I tried a fast-path but the winnings were minimal and small regressions at other benchmarks so we didn't do it.
And we recently expanded the js_StringToInt32 case to cover js_ValueToNumber and js_StringToNumber.

Maybe we should just declare this either fixed or wontfix depending on mood.  ;)
bz: please mark FIXED if you agree that's better (I think it is).

/be
Sold.
Status: NEW → RESOLVED
Closed: 14 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.