<div dir="ltr">Has anybody done any performance benchmarking on this?  I imagine the changes would be significant based on how hot the vector code is.  There are 8 cases I see that would be worth looking into: unsigned and size_t, with and without bounds checking, 32-bit and 64-bit architectures.  The performance gains of not doing bounds checking would be worth being extra careful in some cases.<div><br></div><div><div><div class="gmail_extra">Alex</div><div class="gmail_extra"><br><div class="gmail_quote">On Wed, Nov 19, 2014 at 4:13 PM, Chris Dumez <span dir="ltr">&lt;<a href="mailto:cdumez@apple.com" target="_blank">cdumez@apple.com</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div style="word-wrap:break-word">If we don’t want to crash on overflow, the callers can use the try*() API I believe (e.g. tryAppend()). This returns false (and does not resize the vector) instead of crashing, when we reach the size limit.<span class=""><br><div>
<div style="color:rgb(0,0,0);letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;word-wrap:break-word"><div><br></div><div>Kr,</div><div>--</div><div>Chris Dumez - Apple Inc.</div><div>Cupertino, CA</div><div><br></div></div><br><br>

</div>
<br></span><div><div class="h5"><div><blockquote type="cite"><div>On Nov 19, 2014, at 2:58 PM, Alexey Proskuryakov &lt;<a href="mailto:ap@webkit.org" target="_blank">ap@webkit.org</a>&gt; wrote:</div><br><div><div style="word-wrap:break-word"><br><div><div>19 нояб. 2014 г., в 13:58, Filip Pizlo &lt;<a href="mailto:fpizlo@apple.com" target="_blank">fpizlo@apple.com</a>&gt; написал(а):</div><br><blockquote type="cite"><div style="word-wrap:break-word"><blockquote type="cite" style="font-family:Helvetica;font-size:12px;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;line-height:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px"><div><div style="word-wrap:break-word"><div>With Vector though, I don&#39;t know how we would differentiate code paths that need large allocations from ones that don&#39;t. Nearly anything that is exposed as a JS API or deals with external world can hit sizes over 4Gb. That&#39;s not out of reach in most scenarios, not even for resources loaded from network.</div></div></div></blockquote><div style="font-family:Helvetica;font-size:12px;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;line-height:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px"><br></div><div style="font-family:Helvetica;font-size:12px;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;line-height:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px">Can you provide an example?</div></div></blockquote><br></div><div>Yes. XMLHttpRequest::m_binaryResponseBuilder keeps the downloaded data in a Vector, so any time there is much data, something bad will happen. This is a case that we should support, and not just crash as we would when we think that only exploits would try to use as much memory.</div><div><br></div><div>All code that is Blob related also uses Vectors, and of course Blobs can legitimately be large.</div><div><br></div><div>Crypto code uses Vectors internally for the data.</div><div><br></div><div>These and related uses are all over the place - see also Vectors in FormDataBuilder, data returned from FrameLoader::loadResourceSynchronously, plug-in code that loads from network, SharedBuffer etc.</div><div><br></div><div>
<div style="letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;word-wrap:break-word"><div>- Alexey</div><div><br></div></div></div></div></div></blockquote></div><br></div></div></div><br>_______________________________________________<br>
webkit-dev mailing list<br>
<a href="mailto:webkit-dev@lists.webkit.org">webkit-dev@lists.webkit.org</a><br>
<a href="https://lists.webkit.org/mailman/listinfo/webkit-dev" target="_blank">https://lists.webkit.org/mailman/listinfo/webkit-dev</a><br>
<br></blockquote></div><br><br clear="all"><div><br></div>-- <br><div class="gmail_signature"><p> </p><p>Alex Christensen</p><p>FlexSim Software Products, Inc.</p><p><i><span style="font-size:10pt">1577 North Technology Way | Building A | Suite 2300 | Orem, Utah 84097</span></i></p><p><i><span style="font-size:10pt">Voice: <a value="+18012246914" style="color:rgb(17,85,204)">801-224-6914</a> | Fax: <a value="+18012246984" style="color:rgb(17,85,204)">801-224-6984</a></span></i></p><p><i><span style="font-size:10pt">Email:</span></i><span style="font-size:10pt"> </span><a href="mailto:kimw@flexsim.com" style="color:rgb(17,85,204)" target="_blank"><span style="font-size:10pt;color:blue">alexc@flexsim.com</span></a><span style="font-size:10pt"></span></p><p><i><span style="font-size:10pt">URL:</span></i><span style="font-size:10pt"> </span><a href="http://www.flexsim.com/" style="color:rgb(17,85,204)" target="_blank"><span style="font-size:10pt;color:blue">www.flexsim.com</span></a><span style="font-size:10pt"></span></p><p> </p><p><span style="font-size:10pt">----------------------------------------------------------------------------------------</span><span style="font-size:12pt"> <br></span><span style="font-size:10pt">This message may contain confidential information, and is</span><span style="font-size:12pt"> </span><span style="font-size:10pt">intended</span></p><p><span style="font-size:10pt">only for the use of the individual(s) to whom it is</span><span style="font-size:12pt"> </span><span style="font-size:10pt">addressed.</span><span style="font-size:12pt"> <br></span><span style="font-size:10pt">----------------------------------------------------------------------------------------</span></p></div>
</div></div></div></div>