Skip to content
This repository was archived by the owner on Nov 15, 2017. It is now read-only.

Commit e110f32

Browse files
committed
extracting a bit more info from (commented out) histogram()
1 parent 806b706 commit e110f32

File tree

1 file changed

+16
-2
lines changed

1 file changed

+16
-2
lines changed

js/abp-filters.js

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -897,11 +897,23 @@ var histogram = function(label, categories) {
897897
});
898898
}
899899
}
900+
901+
console.log('Histogram %s', label);
902+
900903
var total = h.length;
901904
h.sort(function(a, b) { return b.n - a.n; });
905+
906+
// Find indices of entries of interest
907+
var target = 2;
908+
for ( var i = 0; i < total; i++ ) {
909+
if ( h[i].n === target ) {
910+
console.log('\tEntries with only %d filter(s) start at index %s (key = "%s")', target, i, h[i].k);
911+
target -= 1;
912+
}
913+
}
914+
902915
h = h.slice(0, 50);
903916
904-
console.log('Histogram %s', label);
905917
h.forEach(function(v) {
906918
console.log('\tkey=%s count=%d', v.k, v.n);
907919
});
@@ -1008,7 +1020,9 @@ Top 50 (key prefix removed because it displayed as garbage):
10081020
key= facebook.c count=12
10091021
key= 2mdn.n count=12
10101022
key= js.r count=12
1011-
Total buckets count: 22149
1023+
Entries with only 2 filter(s) start at index 952 (key = " united-d")
1024+
Entries with only 1 filter(s) start at index 2435 (key = " /analyticstracking_")
1025+
Total buckets count: 22149
10121026
10131027
TL;DR:
10141028
Worst case scenario = 91 filters to test

0 commit comments

Comments
 (0)