Maximum memory used
Peak memory usage measured during experiment.
Chrome: 1216.16 MB [Largest]
Firefox: 327.65 MB [Smallest]
Opera: 554.11 MB
Safari: 517.00 MB
Average memory used
Average of all memory checkpoints throughout experiment.
Chrome: 543.83 MB [Largest]
Firefox: 166.82 MB [Smallest]
Opera: 347.45 MB
Safari: 319.44 MB
Final memory used
Figures taken after all tabs were closed at end.
Chrome: 109.49 MB
Firefox: 106.66 MB [Smallest]
Opera: 441.49 MB [Largest]
Safari: 349.62 MB
Here we see the source code written in the C# that issues commands to the browsers specified in the static string array. All the five browsers support command-line arguments of the form of a URL with no prefix. The program uses pauses with the Thread.Sleep method to try to introduce more unpredictability into the benchmark. This could avoid edge cases where the a certain timing could interact with a browser's cache algorithms in a less representative way.Firefox 3.5 also had the best average memory usage figures, meaning that it may consume the least memory of these browsers when used for the Alexa sites as tested in the benchmark. Finally, Chrome and Firefox posted the best memory figures at the end of the browsing session, with Opera consuming 4.1 times more memory than Firefox at the end of the test.
Code: Select all
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Threading;
class Program
{
/// <summary>
/// Number of points to close stuff.
/// </summary>
const int _interrupt = 30;
/// <summary>
/// Browsers urls are sent to.
/// </summary>
static string[] _browsers =
{
@"C:\Program Files\Mozilla Firefox 3.5 Beta 4\firefox.exe",
@"C:\Program Files\Safari\Safari.exe",
//@"C:\Program Files\Internet Explorer\iexplore.exe",
@"C:\Program Files\Opera 10 Preview\opera.exe",
@"C:\Users\Sam\AppData\Local\Google\Chrome\Application\chrome.exe"
};
static void Main()
{
var r = new Random();
var ct = 1;
foreach (var url in GetUrls())
{
if ((ct % 30) == 0) // Notify
{
Console.BackgroundColor = ConsoleColor.DarkRed;
Console.ForegroundColor = ConsoleColor.White;
Console.WriteLine("Close all tabs but one in all browsers then press enter.");
Console.ResetColor();
Console.ReadLine();
}
foreach (var b in _browsers) // Loop through browsers
{
try
{
var info = new ProcessStartInfo(b, url);
Process.Start(info); // Start url in this browser
Thread.Sleep(r.Next(100, 1000)); // Sleep 100 ms - 1 s
}
catch
{
}
}
Thread.Sleep(r.Next(2000, 5000)); // Sleep 2 - 5 seconds.
ct++;
}
}
/// <summary>
/// Get list of top 2000 urls.
/// </summary>
static IEnumerable<string> GetUrls()
{
return File.ReadAllLines("top.txt").Where(item => item != null &&
item.Length > 1 &&
item[0] != '#').Select(item => "http://" + item);
}
}