<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "https://bugs.webkit.org/page.cgi?id=bugzilla.dtd">

<bugzilla version="5.0.4.1"
          urlbase="https://bugs.webkit.org/"
          
          maintainer="admin@webkit.org"
>

    <bug>
          <bug_id>105186</bug_id>
          
          <creation_ts>2012-12-17 09:00:57 -0800</creation_ts>
          <short_desc>V8 SerializedScriptValue assignment is expensive</short_desc>
          <delta_ts>2013-09-25 08:36:14 -0700</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>1</classification_id>
          <classification>Unclassified</classification>
          <product>WebKit</product>
          <component>WebCore JavaScript</component>
          <version>528+ (Nightly build)</version>
          <rep_platform>Unspecified</rep_platform>
          <op_sys>Unspecified</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>WONTFIX</resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords></keywords>
          <priority>P2</priority>
          <bug_severity>Normal</bug_severity>
          <target_milestone>---</target_milestone>
          <dependson>104354</dependson>
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Alec Flett">alecflett</reporter>
          <assigned_to name="Nobody">webkit-unassigned</assigned_to>
          <cc>andersca</cc>
    
    <cc>noel.gordon</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>792766</commentid>
    <comment_count>0</comment_count>
    <who name="Alec Flett">alecflett</who>
    <bug_when>2012-12-17 09:00:57 -0800</bug_when>
    <thetext>After bug 104354 is fixed, the easiest interface to SSV is via Vector&lt;uint8_t&gt;

The problem is that when you assign a Vector&lt;uint8_t&gt; to the SSV, it immediately does a byte-swapping copy (using htons/ntohs) and when you read the buffer from the SSV it does a similar byte-swapping copy.

Two things need to be fixed:
1) The copy should be avoided by also having an adopt-ing constructor
2) The htons/ntohs for parsing/serializing should be happening in the parser/serializer

The reason this is important is that there are use cases (like IDB) where SSV is used as an intermediate stage that MIGHT never get parsed/deserialized.

The IDB case is: A key and value are read from the database, and passed up to a JS caller. The JS caller never looks at the &quot;value&quot; so we shouldn&apos;t be paying the price of mucking with those bits.

While there, the whole V8 SSV parser/serializer uses String as its interface, which is really broken simply from a code perspective because a String is a buffer of 16-bit characters, but the parser/serializer internally just deals with a stream of bytes.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>828154</commentid>
    <comment_count>1</comment_count>
    <who name="noel gordon">noel.gordon</who>
    <bug_when>2013-02-07 21:03:36 -0800</bug_when>
    <thetext>(In reply to comment #0)

&gt; While there, the whole V8 SSV parser/serializer uses String as its interface, which is really broken simply from a code perspective because a String is a buffer of 16-bit characters, but the parser/serializer internally just deals with a stream of bytes.

It&apos;s also broken from a performance perspective-- lots of extra data copying going on due to String, compared with the JSC SSV implementation.

Internally in the V8 SSV, the &quot;stream of bytes&quot; you mention is a WTF:Vector.  Exposing the SSV data to users is via String, as you note, means conversion from Vector-&gt;String first, but then the String is exposed on the API with String.isolatedCopy().   Yeap, that&apos;s yet another complete copy of the String data.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>933025</commentid>
    <comment_count>2</comment_count>
    <who name="Anders Carlsson">andersca</who>
    <bug_when>2013-09-25 08:36:14 -0700</bug_when>
    <thetext>V8 is gone.</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>