[webkit-reviews] review granted: [Bug 31839] JSON.stringify performance on undefined is very poor : [Attachment 43802] Patch

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Tue Nov 24 13:30:57 PST 2009


Alexey Proskuryakov <ap at webkit.org> has granted Oliver Hunt
<oliver at apple.com>'s request for review:
Bug 31839: JSON.stringify performance on undefined is very poor
https://bugs.webkit.org/show_bug.cgi?id=31839

Attachment 43802: Patch
https://bugs.webkit.org/attachment.cgi?id=43802&action=review

------- Additional Comments from Alexey Proskuryakov <ap at webkit.org>
> +    class StringBuilder : public Vector<UChar> {

Subclassing Vector is unsafe, because it does not have a virtual destructor.
Maybe adding private operator delete would make it a little safer? I'm not 100%
clear on what the best way to make it safe is.

> +	       for (size_t i = 0; i < len; i++)
> +		   Vector<UChar>::append(str[i]);

Should we ASSERT that the only low ASCII is used here? Otherwise, conversion
from signed to unsigned could go badly (not to mention that we don't know what
encoding it is).

> +	   inline void append(const char ch)

Someone could ask you why you don't use full words instead of those "ch", "len"
and "str".

> +	       Vector<UChar>::append(ch);

Would a simple "using Vector<UChar>::append" achieve the same result?

r=me


More information about the webkit-reviews mailing list