Avoid a strlen call in NumberToStringWithBase for int32 values

RESOLVED FIXED in Firefox 62

Status

()

enhancement
RESOLVED FIXED
11 months ago
11 months ago

People

(Reporter: anba, Assigned: anba)

Tracking

Trunk
mozilla62
Points:
---

Firefox Tracking Flags

(firefox62 fixed)

Details

Attachments

(1 attachment)

Comment hidden (empty)
(Assignee)

Comment 1

11 months ago
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+

Comment 4

11 months ago
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

Comment 5

11 months ago
bugherder
https://hg.mozilla.org/mozilla-central/rev/eacd6f23d1d6
Status: ASSIGNED → RESOLVED
Last Resolved: 11 months ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla62
You need to log in before you can comment on or make changes to this bug.