Benchmark public javascipt CDNs on a VPS

This is a legacy script from when I was 13 years old. Please don’t give me a hard time

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
#!/bin/bash
function speedTest {
	# ripped off from http://freevps.us/downloads/bench.sh 
	local the_speed=$( wget -O /dev/null "http://$1" 2>&1 | awk '/\/dev\/null/ {speed = $3 $4} END {gsub(/\(|\)/,"",speed); print speed}')
	echo $the_speed
}

echo "jsTest.sh by IshanDS www.ishands.cf"
echo ""
# CDNJs
cdnjs=$(speedTest "cdnjs.cloudflare.com/ajax/libs/jquery/2.1.1/jquery.min.js")
echo "Speed from CDNJs:             $cdnjs"

# Google CDN
google=$(speedTest "ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js")
echo "Speed from Google CDN:        $google"

# jsDelivr
jsdelivr=$(speedTest "cdn.jsdelivr.net/jquery/2.1.1/jquery.min.js")
echo "Speed from jsDelivr:          $jsdelivr"

# MaxCDN OSS
maxcdn=$(speedTest "oss.maxcdn.com/jquery/2.1.1/jquery.min.js")
echo "Speed from MaxCDN:            $maxcdn"

# Jquery CDN
jquery=$(speedTest "code.jquery.com/jquery-2.1.1.min.js")
echo "Speed from Jquery CDN:        $jquery"

# Microsoft CDN
microsoft=$(speedTest "ajax.aspnetcdn.com/ajax/jquery/jquery-2.1.1.min.js")
echo "Speed from Microsoft CDN:     $microsoft"

echo ""
echo "Thank you for using jsTest.sh"

Read Next

I’m running an experiment for better content recommendations. These are the 3 posts that are most likely to be interesting for you:

All content is licensed under CC BY-NC-SA 4.0. Copying is an act of love - please copy!
More cool websites: Prev | Hotline Webring | Next
Built with Hugo
Theme Stack designed by Jimmy