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

Side by Side Diff: PerformanceTests/Parser/query-selector-id-last.html

Issue 14581013: Optimized querySelector(All) when selector contains #id. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 7 years, 7 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
OLDNEW
1 <!DOCTYPE html> 1 <!DOCTYPE html>
2 <html> 2 <html>
3 <body> 3 <body>
4 <script src="../resources/runner.js"></script> 4 <script src="../resources/runner.js"></script>
5 <script> 5 <script>
6 for (var i = 0; i < 1000; i++) { 6 for (var i = 0; i < 1000; i++) {
7 var div = document.createElement("div"); 7 var div = document.createElement("div");
8 div.id = "foo" + i; 8 div.id = "foo" + i;
9 div.className = "bar" + i; 9 div.className = "bar" + i;
10 document.body.appendChild(div); 10 document.body.appendChild(div);
11 } 11 }
12 12
13 var h1 = document.createElement("h1"); 13 var h1 = document.createElement("h1");
14 h1.id = "id"; 14 h1.id = "id";
15 h1.className = "class"; 15 h1.className = "class";
16 document.body.appendChild(h1); 16 document.body.lastChild.appendChild(h1);
17 17
18 PerfTestRunner.measureRunsPerSecond({ 18 PerfTestRunner.measureRunsPerSecond({
19 description: "This benchmark tests querySelector() for an element that appea rs near the tail of the document", 19 description: "This benchmark tests querySelector() for an element that appea rs near the tail of the document, and is a child of an element with a given id",
20 run: function() { 20 run: function() {
21 for (var i = 0; i < 100; i++) { 21 for (var i = 0; i < 100; i++) {
22 document.querySelector("h1"); 22 var res = document.querySelector("#foo999 > h1");
haraken 2013/05/14 00:32:58 Ditto.
23 document.querySelector("#id");
24 document.querySelector(".class");
25 } 23 }
26 }}); 24 }});
27 </script> 25 </script>
28 </body> 26 </body>
29 </html> 27 </html>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698