Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 library dromaeo; | 1 library dromaeo; |
| 2 import 'dart:async'; | 2 import 'dart:async'; |
| 3 import 'dart:html'; | 3 import 'dart:html'; |
| 4 import 'dart:json' as json; | 4 import "dart:convert"; |
| 5 import 'dart:math' as Math; | 5 import 'dart:math' as Math; |
| 6 part 'Common.dart'; | 6 part 'Common.dart'; |
| 7 part 'RunnerSuite.dart'; | 7 part 'RunnerSuite.dart'; |
| 8 | 8 |
| 9 void main() { | 9 void main() { |
| 10 final int num = 400; | 10 final int num = 400; |
| 11 var random = new Math.Random(); | 11 var random = new Math.Random(); |
| 12 | 12 |
| 13 String str = 'null'; | 13 String str = 'null'; |
| 14 // Very ugly way to build up the string, but let's mimic JS version as much as possible. | 14 // Very ugly way to build up the string, but let's mimic JS version as much as |
| 15 // possible. | |
| 15 for (int i = 0; i < 1024; i++) { | 16 for (int i = 0; i < 1024; i++) { |
| 16 str = "$str${new String.fromCharCodes([((25 * random.nextDouble()) + 97).toI nt()])}"; | 17 str += new String.fromCharCode(((25 * random.nextDouble()) + 97).toInt()); |
|
Emily Fortuna
2013/08/28 21:09:54
Are these two forms identical, perf-wise? I'm not
floitsch
2013/08/28 21:12:15
The new one could be faster (although I'm not sure
Emily Fortuna
2013/08/28 21:19:01
Agreed StringBuffer is the fastest way for sure--
| |
| 17 } | 18 } |
| 18 | 19 |
| 19 List<Node> elems = <Node>[]; | 20 List<Node> elems = <Node>[]; |
| 20 | 21 |
| 21 // Try to force real results. | 22 // Try to force real results. |
| 22 var ret; | 23 var ret; |
| 23 | 24 |
| 24 final htmlstr = document.body.innerHtml; | 25 final htmlstr = document.body.innerHtml; |
| 25 | 26 |
| 26 new Suite(window, 'dom-modify') | 27 new Suite(window, 'dom-modify') |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 62 .test('appendChild', () { | 63 .test('appendChild', () { |
| 63 for (int i = 0; i < elems.length; i++) | 64 for (int i = 0; i < elems.length; i++) |
| 64 document.body.append(elems[i]); | 65 document.body.append(elems[i]); |
| 65 }) | 66 }) |
| 66 .test('insertBefore', () { | 67 .test('insertBefore', () { |
| 67 for (int i = 0; i < elems.length; i++) | 68 for (int i = 0; i < elems.length; i++) |
| 68 document.body.insertBefore(elems[i], document.body.firstChild); | 69 document.body.insertBefore(elems[i], document.body.firstChild); |
| 69 }) | 70 }) |
| 70 .end(); | 71 .end(); |
| 71 } | 72 } |
| OLD | NEW |