[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:19:45 PST 2009


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


Joseph Pecoraro <joepeck at webkit.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |joepeck at webkit.org




--- Comment #4 from Joseph Pecoraro <joepeck at webkit.org>  2009-11-24 12:19:44 PST ---
(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

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