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 SimpleSplit() { |
| 11 str.split(re); |
| 12 } |
| 13 |
| 14 function Split1Setup() { |
| 15 re = /[Cz]/; |
| 16 str = createHaystack(); |
| 17 } |
| 18 |
| 19 function Split2Setup() { |
| 20 re = /[Cz]/u; |
| 21 str = createHaystack(); |
| 22 } |
| 23 |
| 24 function Split3Setup() { |
| 25 re = /[Cz]/y; |
| 26 str = createHaystack(); |
| 27 } |
| 28 |
| 29 function Split4Setup() { |
| 30 re = /[Cz]/uy; |
| 31 str = createHaystack(); |
| 32 } |
| 33 |
| 34 function Split5Setup() { |
| 35 re = /[Cz]/; |
| 36 str = ""; |
| 37 } |
| 38 |
| 39 function Split6Setup() { |
| 40 re = /[cZ]/; // No match. |
| 41 str = createHaystack(); |
| 42 } |
| 43 |
| 44 function Split7Setup() { |
| 45 re = /[A-Za-z\u0080-\u00FF ]/; |
| 46 str = "hipopótamo maçã pólen ñ poção água língüa"; |
| 47 } |
| 48 |
| 49 var benchmarks = [ [SimpleSplit, Split1Setup], |
| 50 [SimpleSplit, Split2Setup], |
| 51 [SimpleSplit, Split3Setup], |
| 52 [SimpleSplit, Split4Setup], |
| 53 [SimpleSplit, Split5Setup], |
| 54 [SimpleSplit, Split6Setup], |
| 55 [SimpleSplit, Split7Setup], |
| 56 ]; |
OLD | NEW |