MAMA: Scripting - quantities and sizes
Index:
- Introduction
- Quantities of script components in Web pages
- Venn diagram: script usage by type
- Sizes: external script
- Sizes: embedded script
- Sizes: event handler script
- Sizes: hyperlink JavaScript
Introduction
Scripting was detected in 2,617,305 of MAMA's URLs, from 4 different sources:
- External scripts via the
SCRIPT
/Src
element/attribute - Embedded scripts as inline content of the
SCRIPT
element - Common event handler attributes (attributes beginning with the string "on")
- JavaScript URL syntax used by hyperlinks (Any content after the leading string "javascript:" in a hyperlink)
All of these sources together form an interesting and complex backdrop on which to paint our analysis of what MAMA discovered about script usage on the Web.
Quantities of script components in Web pages
Of the 4 possible methods to specify scripting, the most popular technique found by MAMA is embedded script - just over 88% of scripts used this method. External scripts and event handler attributes were used in a similar number of cases, both used in ~2/3 of all scripting cases. The "quantity per page" values and other counters represent the number of occurrences for the specific syntax that was discovered for a URL. For example, the maximum number of external scripts encountered in any single page was 264; the maximum number of event handlers discovered was 37,658. The average "per-page" numbers listed in the table below (Fig 2-1) apply where that type of scripting was used and does not cover the total MAMA URL space.
Script type | Description | Total URLs containing script type | % Total script usage |
Most popular quantity |
Max. quantity per page | Avg. quantity per page |
---|---|---|---|---|---|---|
Embedded scripts | Inline content of the SCRIPT element | 2,303,363 | 88.01% | 1 | 2,010 | 3.6 |
Event handlers | Content of attributes beginning with "on" | 1,707,594 | 65.24% | 1 | 37,658 | 19.2 |
External scripts | Content from SCRIPT /Src URLs | 1,651,383 | 63.09% | 1 | 264 | 2.5 |
JavaScript URLs | Hyperlink URLs prefaced by "javascript:" | 483,936 | 18.49% | 1 | 3,396 | 4.9 |
Maximum quantities of the script usage types
URL | Embedded script qty |
---|---|
http://www.realestateinform.com/ | 2,010 |
http://www.momentoffame.com/photopost/index.php | 1,901 |
http://www.cafes.es/ | 1,865 |
URL | Event script qty |
---|---|
http://www.gibson.com/en-us/Divisions/Gibson%20Original/Gibson%20Mandolins/ | 37,658 |
http://ww2.keeneland.com/default.aspx (URL no longer active) | 11,583 |
http://www.mriresearch.org/ | 7,630 |
URL | External script qty |
---|---|
http://www.basisonline.org/the_wager/index.html | 264 |
http://www.hear.org/starr/hiplants/images/family/rubiaceae.htm | 255 |
http://www.schwarzeneggergovernor.com/ | 164 |
URL | JavaScript URL qty |
---|---|
http://consc.net/mindpapers/2/all/ | 3,396 |
http://www.anrc.ro/DesktopDefault.aspx?tabid=1318 (URL no longer active) | 2,495 |
http://www.affairsoftheheart.info/ | 2,382 |
Venn diagram: script usage by type
The most common script usage was the intersection of external and embedded script with event handler attributes. The rarest combination detected was the use of only event handler script with JavaScript URLs. To get a clearer view of the uses and intersections of the different script specification methods, let's examine a helpful Venn diagram. Of all the Venn diagrams for MAMA, this one is the most daunting; a 4-part intersection is rather complex.
Note: Region sizes are not to scale
Sizes: external script
Unlike the 3 other scripting component types, the distribution of sizes for external scripts is not uniform. It does not spike immediately at small sizes and then quickly level off. There are at least two noticeable peaks in the middle of the range - first a modest one between 14-16,000 characters, and then a much bigger one between 20-22,000 characters. The average total external script size is thus increased to a significant 26,550.4 characters. The maximum size recorded by MAMA was an incredible 10,008,659 characters, but this result was not directly reproducible several months later at the time of writing. Instead, another URL took up the torch - lasallecounty.org with a maximum external script size of 14,257,992 characters in only 2 external scripts. This has to be an authoring mistake. One would not expect such an outlandish size case to remain this way, as users would likely never tolerate waiting for a script that big to finish loading. The other URLs that made MAMA's maximum external script size list were 1/4 the size of lasallecounty.org or less.
Size distribution of external script
Size range | Frequency | Size range | Frequency | Size range | Frequency | ||
---|---|---|---|---|---|---|---|
=0 | 1,907,375 | >8000 && <=9000 | 29,061 | >26000 && <=28000 | 32,659 | ||
>0 && <= 500 | 75,958 | >9000 && <=10000 | 18,163 | >28000 && <=30000 | 36,898 | ||
>500 && <=1000 | 80,535 | >10000 && <=12000 | 32,588 | >30000 && <=35000 | 67,502 | ||
>1000 && <=2000 | 103,223 | >12000 && <=14000 | 27,771 | >35000 && <=40000 | 65,848 | ||
>2000 && <=3000 | 99,197 | >14000 && <=16000 | 85,204 | >40000 && <=45000 | 37,688 | ||
>3000 && <=4000 | 70,486 | >16000 && <=18000 | 45,346 | >45000 && <=50000 | 28,266 | ||
>4000 && <=5000 | 43,395 | >18000 && <=20000 | 29,499 | >50000 && <=75000 | 111,160 | ||
>5000 && <=6000 | 46,157 | >20000 && <=22000 | 147,081 | >75000 && <=100000 | 46,699 | ||
>6000 && <=7000 | 48,650 | >22000 && <=24000 | 54,757 | >100000 && <=150000 | 34,957 | ||
>7000 && <=8000 | 28,468 | >24000 && <=26000 | 45,402 | >150000 | 29,187 |
Maximum sizes of external script
URL | External script size (chars) |
---|---|
http://www.lasallecounty.org/index.htm | 14,257,992 |
http://www.dockendorf.biz/index.html | 3,486,769 |
http://www.nordicway.com/index.html | 2,735,461 |
http://www.languagesource.com/ | 1,996,866 |
Sizes: embedded script
The overall size of embedded scripts tapers off gradually, with the average size being 2,481.8 characters. The largest embedded script total size that MAMA analyzed was 2,937,643 characters, but the case with the biggest live verifiable size was 2,251,905 characters (pathguy.com). The URLs representing the maximum values used scripting in some unusual ways. real-estate-denver-colorado.com is a particularly odd case, filled with over 73,000 lines of JavaScript devoted to form validation of 12,190 specific invalid user names for its site. Another case (asciimation.co.nz) stores frame after frame of ASCII pictures representing the Star Wars saga as JavaScript arrays (I have a bad feeling about this).
Size distribution of embedded script
Size range | Frequency | Size range | Frequency | Size range | Frequency | ||
---|---|---|---|---|---|---|---|
=0 | 1,208,935 | >7000 && <=8000 | 26,361 | >25000 && <=30000 | 8,525 | ||
>0 && <= 500 | 776,696 | >8000 && <=9000 | 20,826 | >30000 && <=35000 | 4,505 | ||
>500 && <=1000 | 340,766 | >9000 && <=10000 | 16,121 | >35000 && <=40000 | 3,001 | ||
>1000 && <=2000 | 524,775 | >10000 && <=12000 | 22,112 | >40000 && <=45000 | 2,390 | ||
>2000 && <=3000 | 213,289 | >12000 && <=14000 | 14,856 | >45000 && <=50000 | 1,243 | ||
>3000 && <=4000 | 116,929 | >14000 && <=16000 | 12,299 | >50000 && <=75000 | 3,473 | ||
>4000 && <=5000 | 79,642 | >16000 && <=18000 | 8,181 | >75000 && <=100000 | 1,089 | ||
>5000 && <=6000 | 50,892 | >18000 && <=20000 | 5,484 | >100000 && <=150000 | 591 | ||
>6000 && <=7000 | 35,840 | >20000 && <=25000 | 9,832 | >150000 | 527 |
Maximum sizes of embedded script
URL | Embedded script size (chars) |
---|---|
http://www.pathguy.com/cg35.htm | 2,251,905 |
http://www.real-estate-denver-colorado.com/ | 2,247,372 |
http://www.asciimation.co.nz/ | 2,192,120 |
http://www.ymps.ttct.edu.tw/index.html | 1553,583 |
Sizes: event handler script
The total size of most event handler uses is less than 2,000 characters, with over half of the uses being less than 500 total characters. For a rough calculation, we can add this together with the average quantity of event handlers (19) mentioned previously, giving an approximate size per average event handler of 26 characters. True, combining these averages together in such a manner is questionable, but it helps to demonstrate that event handlers will likely be used for very short, atomic script code or to point to longer functions in external and embedded scripts.
The maximum recorded total size for event handlers was 3,437,290 characters, but live analysis of some of these chart-topping URLs revealed a maximum of only 1,812,178 characters - just over half as many (but still extremely large). The average total event handler size was 973.0 characters.
Unlike the typical brief uses already mentioned, some authors go overboard when using event handlers (using hundreds or even thousands of instances). One hopes that such code is produced programmatically, because it would be difficult to keep track of so many individual code snippets; not to mention that such uses waste a reader's bandwidth. The ohiosmiles.com, keen.land.com and reactome.org cases each apply several event handlers to EVERY link, resulting in thousands of instances in a single document...Exhausting!
Size distribution of event handler script
Size range | Frequency | Size range | Frequency | Size range | Frequency | ||
---|---|---|---|---|---|---|---|
=0 | 1,812,178 | >7000 && <=8000 | 4,609 | >25000 && <=30000 | 639 | ||
>0 && <= 500 | 910,605 | >8000 && <=9000 | 3,196 | >30000 && <=35000 | 346 | ||
>500 && <=1000 | 326,661 | >9000 && <=10000 | 2,474 | >35000 && <=40000 | 245 | ||
>1000 && <=2000 | 263,615 | >10000 && <=12000 | 3,366 | >40000 && <=45000 | 160 | ||
>2000 && <=3000 | 94,675 | >12000 && <=14000 | 1,892 | >45000 && <=50000 | 152 | ||
>3000 && <=4000 | 40,751 | >14000 && <=16000 | 1,311 | >50000 && <=75000 | 295 | ||
>4000 && <=5000 | 20,200 | >16000 && <=18000 | 852 | >75000 && <=100000 | 101 | ||
>5000 && <=6000 | 12,051 | >18000 && <=20000 | 610 | >100000 && <=150000 | 78 | ||
>6000 && <=7000 | 7,033 | >20000 && <=25000 | 1,039 | >150000 | 46 |
Maximum sizes of event handler script
URL | Event script size (chars) |
---|---|
http://www.ohiosmiles.com/ | 1809979 |
http://ww2.keeneland.com/default.aspx (URL no longer active) | 1598238 |
http://www.reactome.org/ | 496996 |
http://www.conflictlab.com/chronicle/911/ | 459875 |
Sizes: hyperlink JavaScript
The size distribution chart shows a rapid falloff in popularity after the 500
character mark, indicating that this type of scripting is usually used sparingly
and only in small snippets. As recorded in MAMA, the maximum detected hyperlink
JavaScript size was a very weighty 1,045,812 characters. The live analysis of
that URL shows a significant reduction, but it is still the top value: 589,097
characters. The average number of characters used for hyperlink JavaScript, when
this type of script is used, was 217.7 characters. Itsandil.rediffiland.com had
its hyperlink JavaScript size distributed across a main page and 6
IFRAME
s. The star-academy.info case is a little
different, in that it used all of its hyperlink JavaScript in the fallback
content inside an IFRAME
element.
Size distribution of hyperlink JavaScript
Size range | Frequency | Size range | Frequency | Size range | Frequency | ||
---|---|---|---|---|---|---|---|
=0 | 3,026,752 | >5000 && <=6000 | 515 | >14000 && <=16000 | 81 | ||
>0 && <= 500 | 442,377 | >6000 && <=7000 | 372 | >16000 && <=18000 | 46 | ||
>500 && <=1000 | 22,084 | >7000 && <=8000 | 174 | >18000 && <=20000 | 38 | ||
>1000 && <=2000 | 10,515 | >8000 && <=9000 | 145 | >20000 && <=25000 | 48 | ||
>2000 && <=3000 | 3,287 | >9000 && <=10000 | 119 | >25000 && <=30000 | 24 | ||
>3000 && <=4000 | 1468 | >10000 && <=12000 | 143 | >30000 && <=35000 | 24 | ||
>4000 && <=5000 | 815 | >12000 && <=14000 | 78 | >35000 | 75 |
Maximum sizes of hyperlink JavaScript
URL | Hyperlink JavaScript size (chars) |
---|---|
http://www.xocoxoco.dk/ (not available anymore) | 589,097 |
http://itsandil.rediffiland.com/iland/itsandil.html | 212,928 |
http://www.star-academy.info/ | 211,069 |
http://www008.upp.so-net.ne.jp/tarch/ (not available anymore) | 157,194 |
This article is licensed under a Creative Commons Attribution, Non Commercial - Share Alike 2.5 license.
Comments
The forum archive of this article is still available on My Opera.