| OLD | NEW |
| 1 class Main { | 1 class Main { |
| 2 static void main() { | 2 static void main() { |
| 3 final int num = 40; | 3 final int num = 40; |
| 4 | 4 |
| 5 // Try to force real results. | 5 // Try to force real results. |
| 6 var ret; | 6 var ret; |
| 7 window.on.load.add((Event evt) { | 7 window.on.load.add((Event evt) { |
| 8 String html = document.body.innerHTML; | 8 String html = document.body.innerHTML; |
| 9 | 9 |
| 10 new Suite('dom-traverse') | 10 new Suite('dom-traverse') |
| 11 .prep(() { | 11 .prep(() { |
| 12 html = BenchUtil.replaceAll(html, 'id="test(\\w).*?"', (Match match) { | 12 html = BenchUtil.replaceAll(html, 'id="test(\\w).*?"', (Match match) { |
| 13 final group = match.group(1); | 13 final group = match.group(1); |
| 14 return 'id="test${group}${num}"'; | 14 return 'id="test${group}${num}"'; |
| 15 }); | 15 }); |
| 16 html = BenchUtil.replaceAll(html, 'name="test.*?"', (Match match) { | 16 html = BenchUtil.replaceAll(html, 'name="test.*?"', (Match match) { |
| 17 return 'name="test${num}"'; | 17 return 'name="test${num}"'; |
| 18 }); | 18 }); |
| 19 html = BenchUtil.replaceAll(html, 'class="foo.*?"', (Match match) { | 19 html = BenchUtil.replaceAll(html, 'class="foo.*?"', (Match match) { |
| 20 return 'class="foo test${num} bar"'; | 20 return 'class="foo test${num} bar"'; |
| 21 }); | 21 }); |
| 22 | 22 |
| 23 final div = document.createElement('div'); | 23 final div = new Element.tag('div'); |
| 24 div.innerHTML = html; | 24 div.innerHTML = html; |
| 25 document.body.nodes.add(div); | 25 document.body.nodes.add(div); |
| 26 }) | 26 }) |
| 27 .test('firstChild', () { | 27 .test('firstChild', () { |
| 28 final nodes = document.body.nodes; | 28 final nodes = document.body.nodes; |
| 29 final nl = nodes.length; | 29 final nl = nodes.length; |
| 30 | 30 |
| 31 for (int i = 0; i < num; i++) { | 31 for (int i = 0; i < num; i++) { |
| 32 for (int j = 0; j < nl; j++) { | 32 for (int j = 0; j < nl; j++) { |
| 33 Node cur = nodes[j]; | 33 Node cur = nodes[j]; |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 75 final nodes = document.body.nodes; | 75 final nodes = document.body.nodes; |
| 76 for (int j = 0; j < nodes.length; j++) { | 76 for (int j = 0; j < nodes.length; j++) { |
| 77 ret = nodes[j]; | 77 ret = nodes[j]; |
| 78 } | 78 } |
| 79 } | 79 } |
| 80 }) | 80 }) |
| 81 .end(); | 81 .end(); |
| 82 }); | 82 }); |
| 83 } | 83 } |
| 84 } | 84 } |
| OLD | NEW |