OLD | NEW |
(Empty) | |
| 1 // Copyright 2016 the V8 project authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 load("base.js"); |
| 6 |
| 7 var str; |
| 8 var re; |
| 9 |
| 10 function Exec() { |
| 11 re.exec(str); |
| 12 } |
| 13 |
| 14 function Exec1Setup() { |
| 15 re = /[Cz]/; |
| 16 str = createHaystack(); |
| 17 } |
| 18 |
| 19 function Exec2Setup() { |
| 20 re = /[Cz]/g; |
| 21 str = createHaystack(); |
| 22 } |
| 23 |
| 24 function Exec3Setup() { |
| 25 re = /([Cz])/y; |
| 26 str = createHaystack(); |
| 27 } |
| 28 |
| 29 function Exec4Setup() { |
| 30 re = /[cZ]/; |
| 31 str = createHaystack(); |
| 32 } |
| 33 |
| 34 function Exec5Setup() { |
| 35 re = /[cZ]/g; |
| 36 str = createHaystack(); |
| 37 } |
| 38 |
| 39 function Exec6Setup() { |
| 40 re = /([cZ])/y; |
| 41 str = createHaystack(); |
| 42 } |
| 43 |
| 44 function Exec7Setup() { |
| 45 re = /[Cz]/gy; |
| 46 re.lastIndex = 2 ** 32; |
| 47 str = createHaystack(); |
| 48 } |
| 49 |
| 50 var benchmarks = [ [Exec, Exec1Setup], |
| 51 [Exec, Exec2Setup], |
| 52 [Exec, Exec3Setup], |
| 53 [Exec, Exec4Setup], |
| 54 [Exec, Exec5Setup], |
| 55 [Exec, Exec6Setup], |
| 56 [Exec, Exec7Setup], |
| 57 ]; |
OLD | NEW |