zlib.js (3693B)
1 // Copyright 2013 the V8 project authors. All rights reserved. 2 // Redistribution and use in source and binary forms, with or without 3 // modification, are permitted provided that the following conditions are 4 // met: 5 // 6 // * Redistributions of source code must retain the above copyright 7 // notice, this list of conditions and the following disclaimer. 8 // * Redistributions in binary form must reproduce the above 9 // copyright notice, this list of conditions and the following 10 // disclaimer in the documentation and/or other materials provided 11 // with the distribution. 12 // * Neither the name of Google Inc. nor the names of its 13 // contributors may be used to endorse or promote products derived 14 // from this software without specific prior written permission. 15 // 16 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 17 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 18 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 19 // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 20 // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 21 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 22 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 23 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 24 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 25 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 27 28 new BenchmarkSuite('zlib', [152815148], [ 29 new Benchmark('zlib', false, true, 10, 30 runZlib, undefined, tearDownZlib, null, 3)]); 31 32 // Generate 100kB pseudo-random bytes (compressed 25906 bytes) and 33 // compress/decompress them 60 times. 34 var zlibEval = eval; 35 function runZlib() { 36 if (typeof Ya != "function") { 37 InitializeZlibBenchmark(); 38 } 39 Ya(["1"]); 40 } 41 42 function tearDownZlib() { 43 delete $; 44 delete $a; 45 delete Aa; 46 delete Ab; 47 delete Ba; 48 delete Bb; 49 delete C; 50 delete Ca; 51 delete Cb; 52 delete D; 53 delete Da; 54 delete Db; 55 delete Ea; 56 delete Eb; 57 delete F; 58 delete Fa; 59 delete Fb; 60 delete G; 61 delete Ga; 62 delete Gb; 63 delete Ha; 64 delete Hb; 65 delete I; 66 delete Ia; 67 delete Ib; 68 delete J; 69 delete Ja; 70 delete Jb; 71 delete Ka; 72 delete Kb; 73 delete L; 74 delete La; 75 delete Lb; 76 delete Ma; 77 delete Mb; 78 delete Module; 79 delete N; 80 delete Na; 81 delete Nb; 82 delete O; 83 delete Oa; 84 delete Ob; 85 delete P; 86 delete Pa; 87 delete Pb; 88 delete Q; 89 delete Qa; 90 delete Qb; 91 delete R; 92 delete Ra; 93 delete Rb; 94 delete S; 95 delete Sa; 96 delete Sb; 97 delete T; 98 delete Ta; 99 delete Tb; 100 delete U; 101 delete Ua; 102 delete Ub; 103 delete V; 104 delete Va; 105 delete Vb; 106 delete W; 107 delete Wa; 108 delete Wb; 109 delete X; 110 delete Xa; 111 delete Y; 112 delete Ya; 113 delete Z; 114 delete Za; 115 delete ab; 116 delete ba; 117 delete bb; 118 delete ca; 119 delete cb; 120 delete da; 121 delete db; 122 delete ea; 123 delete eb; 124 delete fa; 125 delete fb; 126 delete ga; 127 delete gb; 128 delete ha; 129 delete hb; 130 delete ia; 131 delete ib; 132 delete j; 133 delete ja; 134 delete jb; 135 delete k; 136 delete ka; 137 delete kb; 138 delete la; 139 delete lb; 140 delete ma; 141 delete mb; 142 delete n; 143 delete na; 144 delete nb; 145 delete oa; 146 delete ob; 147 delete pa; 148 delete pb; 149 delete qa; 150 delete qb; 151 delete r; 152 delete ra; 153 delete rb; 154 delete sa; 155 delete sb; 156 delete t; 157 delete ta; 158 delete tb; 159 delete u; 160 delete ua; 161 delete ub; 162 delete v; 163 delete va; 164 delete vb; 165 delete w; 166 delete wa; 167 delete wb; 168 delete x; 169 delete xa; 170 delete xb; 171 delete ya; 172 delete yb; 173 delete z; 174 delete za; 175 delete zb; 176 }