Classification results

Initial results on top 100 websites

Of the 40116 scripts we analyzed (3192.7MB, details in script_features.py):

  • Size: 9B~8.7MB, average 80kB, median 2.2kB.
    • Many small scripts.
  • No significant correlation between anything.
  • Coverage: 67% classified by count, 93% by size.
  • Coverage growth potential: 7% by count, 1% by size.
  • Half (1296.1MB, 40.60%) scripts by size fall into all sure categories. Count 1473 (3.67%).
    • Look for bloated sites.
    • What next if we can split it up?
      • What user impact from size? Aggregate per page?
      • Chrome execution time of script.
FeatureCountPercentage (%)Size (MB)Size Percentage (%)
Total Scripts40116-3192.7-
Frontend Processing1412935.222864.389.72
DOM Element Generation819620.432248.970.44
UX Enhancement449611.211840.757.65
Extensional Features491512.251888.159.14
Silent Scripts1026025.5828.10.88
Has Request420510.481432.144.86
Queries Element1364034.002731.685.56
Uses Storage457111.391641.051.40
No Sure Category1314832.77221.16.93
No Category1017825.37179.75.63
Feature CombinationFrontend ProcessingDOM Element GenerationUX EnhancementExtensional FeaturesHas RequestQueries Element
DOM Element Generation6602 (16.46%), 2197.1MB (68.82%)-----
UX Enhancement3840 (9.57%), 1821.5MB (57.05%)3125 (7.79%), 1613.2MB (50.53%)----
Extensional Features4229 (10.54%), 1841.1MB (57.67%)2703 (6.74%), 1562.9MB (48.95%)1844 (4.60%), 1440.5MB (45.12%)---
Has Request3981 (9.92%), 1428.9MB (44.76%)2338 (5.83%), 1192.9MB (37.36%)1459 (3.64%), 1162.6MB (36.42%)1755 (4.37%), 1226.1MB (38.40%)--
Queries Element9379 (23.38%), 2648.1MB (82.94%)6846 (17.07%), 2152.1MB (67.41%)3754 (9.36%), 1773.7MB (55.55%)3508 (8.74%), 1800.3MB (56.39%)3627 (9.04%), 1410.1MB (44.17%)-
Uses Storage4335 (10.81%), 1633.2MB (51.15%)2728 (6.80%), 1362.7MB (42.68%)1669 (4.16%), 1278.9MB (40.06%)2093 (5.22%), 1372.2MB (42.98%)2424 (6.04%), 1106.1MB (34.64%)3722 (9.28%), 1596.9MB (50.02%)
Feature CombinationScripts Count (%)Size (MB) (%)
Frontend Processing & DOM Element Generation & UX Enhancement2813 (7.01%)1604.9MB (50.27%)
Frontend Processing & DOM Element Generation & Extensional Features2679 (6.68%)1533.0MB (48.02%)
Frontend Processing & UX Enhancement & Extensional Features1814 (4.52%)1439.2MB (45.08%)
DOM Element Generation & UX Enhancement & Extensional Features1482 (3.69%)1296.6MB (40.61%)

script_size_cdf

Results with the eval trick on top 1000 websites

We crawled the top 1000 websites with the eval trick applied to scripts. The eval trick rewrites each script into smaller blocks of eval calls, creating V8 execution contexts that maps to smaller blocks of source code. The unit here is execution context, not script anymore.

  • Size: 1B~6MB, average 1.2kB, median 48B, total 26.2GB.
    • Most scripts broken down, but some persisted.
    • Rewritten contexts cover 23.3GB (89.14%) of source code.
      • Some rewritten contexts are still large, probably because of class, else branch, etc.
  • Still no significant correlation between anything.
  • Half of the contexts by size do not call any APIs, 84% by count.
  • Coverage: 86% classified by count, 87% by size. By size, 49.12% silent + 38% classified + 12.87% no-sphere.
    • By size, 98% (3.3GB) of no-sphere contexts make less than 100 API calls.
    • By size, 80% (667MB) of no-sphere contexts are rewritten.
  • One eighth of contexts by size fall into all sure categories (12.37%, 3235.2MB), which is 1/3 of all contexts belonging to some sphere.
    • Much less than previous results, but still high.
FeatureCountPercentage (%)Size (MB)Size Percentage (%)
Total Contexts21027954-26163.2-
Silent Contexts1757281483.5712850.449.12
Frontend Processing3382731.619469.636.19
DOM Element Generation722860.346250.123.89
UX Enhancement265360.135392.020.61
Extensional Features326470.165617.221.47
Has Request168210.084318.816.51
Queries Element1208440.577719.929.51
Uses Storage260810.125142.619.66
Feature CombinationFrontend ProcessingDOM Element GenerationUX EnhancementExtensional FeaturesHas RequestQueries Element
DOM Element Generation20763 (0.10%), 5924.2MB (22.64%)-----
UX Enhancement15544 (0.07%), 5229.6MB (19.99%)12910 (0.06%), 4537.7MB (17.34%)----
Extensional Features13557 (0.06%), 5540.2MB (21.18%)6207 (0.03%), 4006.9MB (15.31%)5369 (0.03%), 3667.5MB (14.02%)---
Has Request10514 (0.05%), 4276.4MB (16.35%)5694 (0.03%), 3081.3MB (11.78%)4519 (0.02%), 3041.1MB (11.62%)4926 (0.02%), 3572.3MB (13.65%)--
Queries Element33064 (0.16%), 7174.1MB (27.42%)29577 (0.14%), 5575.6MB (21.31%)15820 (0.08%), 4875.0MB (18.63%)7871 (0.04%), 4812.3MB (18.39%)7730 (0.04%), 3857.2MB (14.74%)-
Uses Storage13332 (0.06%), 5067.7MB (19.37%)7018 (0.03%), 3569.3MB (13.64%)5109 (0.02%), 3400.2MB (13.00%)5215 (0.02%), 3815.2MB (14.58%)6573 (0.03%), 3583.0MB (13.69%)9930 (0.05%), 4640.1MB (17.74%)
Feature CombinationScripts Count (%)Size (MB) (%)
Frontend Processing & DOM Element Generation & UX Enhancement10291 (0.05%)4483.3MB (17.14%)
Frontend Processing & DOM Element Generation & Extensional Features6022 (0.03%)3975.0MB (15.19%)
Frontend Processing & UX Enhancement & Extensional Features5241 (0.02%)3664.5MB (14.01%)
DOM Element Generation & UX Enhancement & Extensional Features4078 (0.02%)3235.9MB (12.37%)

script_size_cdf2