[Webkit-unassigned] [Bug 31839] JSON.stringify performance on undefined is very poor

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Tue Nov 24 12:28:51 PST 2009


https://bugs.webkit.org/show_bug.cgi?id=31839





--- Comment #5 from Oliver Hunt <oliver at apple.com>  2009-11-24 12:28:51 PST ---
(In reply to comment #4)
> (In reply to comment #3)
> > What is the object structure that leads to us need to roll
> > back the string?
> 
> The JSON result is continually built by appending onto a string builder
> (UString).  JSON specifies that we should not put undefined values in the
> resulting sting.
> 
> The case where it is rolled back is when contents were already put on the
> builder string, and then we encountered an "undefined" value, and we have to
> remove the contents we already put on the string. So in the following case:
> 
>   { a: undefined }
> 
> The builder would follow these steps:
> 
>   Action                                   Builder So Far
>   -----------                              --------------
>   1. start object                          {
>   2. put key and seperator                 {"a":
>   3. encounter undefined value... rollback {
>   4. finish properties, close object       {}
>   5. done

Yeah i saw it once i actually looked at the code.  I'm just testing a patch
that switches stringification over to basically using a Vector<UChar>.  I'm
testing perf, etc now.

-- 
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