Skip to content

Instantly share code, notes, and snippets.

@thoemmi
Created May 17, 2011 13:12
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save thoemmi/976436 to your computer and use it in GitHub Desktop.
Save thoemmi/976436 to your computer and use it in GitHub Desktop.
using System;
using System.Diagnostics;
using System.Net;
namespace ConsoleApplication1 {
internal class Program {
private const int COUNT = 20;
private static void Main() {
var urls = new[] {
"http://sstatic.net/js/full.js",
"http://sstatic.stackexchange.netdna-cdn.com/js/full.js",
"http://d1d5ue6vu5b30i.cloudfront.net/js/full.js",
"http://wac.43df.edgecastcdn.net/8043DF/sstatic/js/full.js"
};
foreach (var url in urls) {
MeasureUrl(url);
}
Console.ReadLine();
}
private static void MeasureUrl(string url) {
var client = new WebClient();
var sw = Stopwatch.StartNew();
for (var i = 0; i < COUNT; ++i) {
client.DownloadData(url);
}
sw.Stop();
Console.WriteLine("URL {0} took {1} ms", url, (sw.ElapsedMilliseconds/COUNT));
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment