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

Unified Diff: PerformanceTests/CSS/SelectorCountScaling.html

Issue 209153002: Add attribute selectors to the SelectorCountScaling performance test. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Fix. Created 6 years, 9 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: PerformanceTests/CSS/SelectorCountScaling.html
diff --git a/PerformanceTests/CSS/SelectorCountScaling.html b/PerformanceTests/CSS/SelectorCountScaling.html
index 68a67fe827caa9cf3ff1b93f9e17024f7d44a6f2..881b6da5f6cf9eb82b247667ba3e9141dea6ff6f 100644
--- a/PerformanceTests/CSS/SelectorCountScaling.html
+++ b/PerformanceTests/CSS/SelectorCountScaling.html
@@ -17,18 +17,27 @@ function insertStyleSheet(css)
return styleElement;
}
-function cssStr(count) {
+function cssStrWithClassSelectors(count) {
var selector = '.a' + count + ' .b' + count + ' { color: red } ';
// Intentionally repeat the same classes many times, to test duplicate optimizations.
return selector + selector + selector + selector + selector + selector + selector;
}
+function cssStrWithAttributeSelectors(count) {
+ var selector = '[attrA' + count + '="1"]' + ' [attrB' + count + '="1"]' + ' { color: red } ';
+ // Intentionally repeat the same classes many times, to test duplicate optimizations.
+ return selector + selector + selector + selector + selector + selector + selector;
+}
+
function runFunction()
{
var numRules = 1000;
var arr = new Array(numRules);
for (var i = 0 ; i < numRules; i++) {
- arr[i] = cssStr(i);
+ arr[i] = cssStrWithClassSelectors(i);
+ }
+ for (var i = 0 ; i < numRules; i++) {
+ arr[numRules + i] = cssStrWithAttributeSelectors(i);
}
var styleElement = insertStyleSheet(arr.join(' '));
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698