Skip to content

Commit e29d1cb

Browse files
committed
Take measurements in milliseconds; count hits
1 parent 198fd2f commit e29d1cb

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed

src/chrome/content/code/HTTPSRules.js

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -638,20 +638,24 @@ const HTTPSRules = {
638638
req.open("GET", "https://eff.org/files/alexa-top-10000-global.txt", false);
639639
req.send();
640640
var domains = req.response.split("\n");
641-
this.log(WARN, "Got array of length " + domains.length);
642641
var domains_l = domains.length - 1; // The last entry in this thing is bogus
642+
this.log(WARN, "Calling potentiallyApplicableRulesets() with " + domains_l + " domains");
643+
var count = 0;
643644
var t1 = new Date().getTime();
644645
for (var n = 0; n < domains_l; n++) {
645-
this.potentiallyApplicableRulesets("www." + domains[n]);
646+
if (this.potentiallyApplicableRulesets("www." + domains[n]).length != 0)
647+
count++;
646648
}
647649
var t2 = new Date().getTime();
648-
this.log(NOTE,domains_l + " calls to potentiallyApplicableRulesets took " + (t2 - t1) / 1000.0 + " seconds");
650+
this.log(NOTE, count + " hits: average call to potentiallyApplicableRulesets took " + (t2 - t1) / domains_l + " milliseconds");
651+
count = 0;
649652
t1 = new Date().getTime();
650653
for (var n = 0; n < domains_l; n++) {
651-
this.potentiallyApplicableRulesets("www." + domains[n]);
654+
if (this.potentiallyApplicableRulesets("www." + domains[n]).length != 0)
655+
count++;
652656
}
653657
t2 = new Date().getTime();
654-
this.log(NOTE,domains_l + " subsequent calls to potentiallyApplicableRulesets took " + (t2 - t1) / 1000.0 + " seconds");
658+
this.log(NOTE, count + " hits: average subsequent call to potentiallyApplicableRulesets took " + (t2 - t1) / domains_l + " milliseconds");
655659
},
656660

657661
shouldSecureCookie: function(applicable_list, c, known_https) {

0 commit comments

Comments
 (0)