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

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

Issue 14581013: Optimized querySelector(All) when selector contains #id. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Fixed review issues in Patch Set 2 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
« no previous file with comments | « no previous file | PerformanceTests/Parser/query-selector-id-last.html » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 var parentDiv = document.body; 6 var parentDiv = document.body;
7 for (var i = 0; i < 1000; i++) { 7 for (var i = 0; i < 1000; i++) {
8 var div = document.createElement("div"); 8 var div = document.createElement("div");
9 div.id = "foo" + i; 9 div.id = "foo" + i;
10 div.className = "bar" + i; 10 div.className = "bar" + i;
11 parentDiv.appendChild(div); 11 parentDiv.appendChild(div);
12 parentDiv = div; 12 parentDiv = div;
13 } 13 }
14 14
15 var h1 = document.createElement("h1"); 15 var h1 = document.createElement("h1");
16 h1.id = "id"; 16 h1.id = "id";
17 h1.className = "class"; 17 h1.className = "class";
18 parentDiv.appendChild(h1); 18 parentDiv.appendChild(h1);
19 19
20 PerfTestRunner.measureRunsPerSecond({ 20 PerfTestRunner.measureRunsPerSecond({
21 description: "This benchmark tests querySelector() for an element that appea rs in the depths in the document", 21 description: "This benchmark tests querySelector() for an element that appea rs in the depths in the document, and is a descendant of an element with a given id",
22 run: function() { 22 run: function() {
23 for (var i = 0; i < 100; i++) { 23 for (var i = 0; i < 100; i++) {
24 document.querySelector("h1"); 24 var res = document.querySelector("#foo998 h1");
25 document.querySelector("#id");
26 document.querySelector(".class");
27 } 25 }
28 }}); 26 }});
29 </script> 27 </script>
30 </body> 28 </body>
31 </html> 29 </html>
OLDNEW
« no previous file with comments | « no previous file | PerformanceTests/Parser/query-selector-id-last.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698