[Webkit-unassigned] [Bug 31330] Expose dtoa() for ECMA-262
bugzilla-daemon at webkit.org
bugzilla-daemon at webkit.org
Wed Nov 11 16:06:58 PST 2009
https://bugs.webkit.org/show_bug.cgi?id=31330
Darin Adler <darin at apple.com> changed:
What |Removed |Added
----------------------------------------------------------------------------
Attachment #42923|review? |review-
Flag| |
--- Comment #3 from Darin Adler <darin at apple.com> 2009-11-11 16:06:58 PST ---
(From update of attachment 42923)
> UString UString::from(double d)
> {
> + return UString(ecma262dtoa(d));
> }
The above change will slow down JavaScriptCore, because it makes an extra copy
of the buffer. The old version translated directly from a char buffer to a
UChar buffer. The new code instead goes from a char buffer to a UChar buffer
and then copies the buffer again to put it into the UString. I don't see an
obvious way to avoid this as long as the dtoa function returns a char buffer
and the ecma262dtoa function returns a UChar buffer. But it's unacceptable to
slow things down without doing performance tests to prove this is not a
significant slowdown for JavaScript execution.
We should investigate other solutions that don't require allocating memory and
copying the string an extra time.
If we can figure out a hard limit for the longest a double could be, then we
could make the function put its result into a C-style array so there is no
extra memory allocation.
> +static ALWAYS_INLINE void appendAscii(const char* src, unsigned size, Vector<UChar, 80>& dst)
Since ASCII is an acronym, we should always capitalize it as ASCII.
I’d like to see a typedef for the vector type here at the top of the file so
the magic number 80 isn’t in three different places.
--
Configure bugmail: https://bugs.webkit.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.
More information about the webkit-unassigned
mailing list