Closed Bug 1466050 Opened 2 years ago Closed 2 years ago

Avoid a strlen call in NumberToStringWithBase for int32 values

Categories

(Core :: JavaScript Engine, enhancement)

enhancement
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla62
Tracking Status
firefox62 --- fixed

People

(Reporter: anba, Assigned: anba)

Details

Attachments

(1 file)

No description provided.
Attached patch bug1466050.patchSplinter Review
Int32ToCString() already returns the string length, so we can reuse that info instead of calling strlen() again in NewStringCopyZ(). This also matches the approach taken in js::NumberValueToStringBuffer().

Also removes an out of date comment in js::NumberValueToStringBuffer.
Attachment #8982448 - Flags: review?(jdemooij)
Comment on attachment 8982448 [details] [diff] [review]
bug1466050.patch

Review of attachment 8982448 [details] [diff] [review]:
-----------------------------------------------------------------

Great :)
Attachment #8982448 - Flags: review?(jdemooij) → review+
Pushed by ryanvm@gmail.com:
https://hg.mozilla.org/integration/mozilla-inbound/rev/eacd6f23d1d6
Skip a call to strlen in Number.prototype.toString when length was already computed. r=jandem
Keywords: checkin-needed
https://hg.mozilla.org/mozilla-central/rev/eacd6f23d1d6
Status: ASSIGNED → RESOLVED
Closed: 2 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla62
You need to log in before you can comment on or make changes to this bug.