Self-hosted Speed Test for HTML5 and more. Easy setup, examples, configurable, mobile friendly. Supports PHP, Node, Multiple servers, and more - librespeed/speedtest
Considering this is about sending some random data to a server and measuring the speed, that's quite large. I've seen whole computer games that fit in 1/10 of that space.
It could fit in a standard 3.5 inch floppy disk, sure it's not the smallest, but for a full app written in javascript and not asm it is, in fact, small