clone-many-transferables.js (939B)
1 // |reftest| slow skip-if(!xulRuntime.shell) -- requires serialize() 2 // Any copyright is dedicated to the Public Domain. 3 // http://creativecommons.org/licenses/publicdomain/ 4 5 function test() 6 { 7 // On my system, with an unfixed build where transfer-list processing is 8 // quadratic, 5e5 elements makes this test take ~70s in a shell opt build. 9 // Debug build is well into timeout-land at 300+s. As long as at least *one* 10 // platform times out for a quadratic algorithm, a regression should be 11 // obvious. (Time to run the test in even a debug shell is ~17s, well short 12 // of timing out.) 13 var transfers = []; 14 for (var i = 0; i < 5e5; i++) 15 transfers.push(new ArrayBuffer()); 16 17 // If serialization is quadratic in the length of |transfers|, the test will 18 // time out. If the test doesn't time out, it passed. 19 serialize({}, transfers); 20 } 21 22 test(); 23 24 if (typeof reportCompare === "function") 25 reportCompare(0, 0, 'ok');