Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(56)

Side by Side Diff: samples/third_party/dromaeo/tests/dom-attr-html.dart

Issue 9732019: dart:html perf optimization based on runing Dromaeo benchmarks (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Fixes Created 8 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 #library("dom_attr_html"); 1 #library("dom_attr");
2 #import("dart:html"); 2 #import("dart:html");
3 #import("dart:json"); 3 #import('runner.dart');
4 #source("Common.dart");
5 #source("RunnerSuite.dart");
6 4
7 void main() { 5 void main() {
8 final int num = 10240; 6 final int num = 10240;
9 7
10 // Try to force real results. 8 // Try to force real results.
11 var ret; 9 var ret;
12 10
13 Element elem = document.query('#test1'); 11 Element elem = document.query('#test1');
14 Element a = document.queryAll('a')[0]; 12 Element a = document.query('a');
15 13
16 new Suite(window, 'dom-attr') 14 new Suite(window, 'dom-attr')
17 .test('getAttribute', () { 15 .test('getAttribute', () {
18 for (int i = 0; i < num; i++) 16 for (int i = 0; i < num; i++)
19 ret = elem.attributes['id']; 17 ret = elem.$dom_getAttribute('id');
20 }) 18 })
21 .test('element.property', () { 19 .test('element.property', () {
22 for (int i = 0; i < num * 2; i++) 20 for (int i = 0; i < num * 2; i++)
23 ret = elem.id; 21 ret = elem.id;
24 }) 22 })
25 .test('setAttribute', () { 23 .test('setAttribute', () {
26 for (int i = 0; i < num; i++) 24 for (int i = 0; i < num; i++)
27 a.attributes['id'] = 'foo'; 25 a.$dom_setAttribute('id', 'foo');
28 }) 26 })
29 .test('element.property = value', () { 27 .test('element.property = value', () {
30 for (int i = 0; i < num; i++) 28 for (int i = 0; i < num; i++)
31 a.id = 'foo'; 29 a.id = 'foo';
32 }) 30 })
33 .end(); 31 .end();
34 } 32 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698