I just heard that Gmail is now finally open for subscriptions, so I headed to gmail.com. While looking at their web page, one weird thing caught my attention: an ever increasing counter of "megabytes" that was contiuously updated. Being a curious guy, I looked at the source. Would this query in realtime the server? Surprise, no! The counter is actually a "fake" one.

Initially, I said to myself: How lame... But then later I realized something very interesting that can give insights on how GMail will evolve in the near future. Read on.

Here is the relevant code sequence:

var CP = [
 [ 1122879600000, 2450 ],
 [ 1125558000000, 2550 ],
 [ 1136102400000, 2950 ]
];

var quota;

[...]

function OnLoad() {
  gaia_setFocus();

  MaybePingUser();
  el("gaia_loginform").Passwd.onfocus = MaybePingUser;

  LogRoundtripTime();
  if (!quota) {
    quota = el("quota");
    updateQuota();
  }

}

function updateQuota() {
  if (!quota) {
    return;
  }
 
  var now = (new Date()).getTime();
  var i;
  for (i = 0; i < CP.length; i++) {
    if (now < CP[i][0]) {
      break;
    }
  }
  if (i == 0) {
    setTimeout(updateQuota, 1000);
  } else if (i == CP.length) {
    quota.innerHTML = CP[i - 1][1];
  } else {
    var ts = CP[i - 1][0];
    var bs = CP[i - 1][1];
    quota.innerHTML = format(((now-ts) / (CP[i][0]-ts) * (CP[i][1]-bs)) + bs);
    setTimeout(updateQuota, 1000);
  }
}

It looks like it's just using the local CP array to compose a somewhat random number which is later displayed on the screen. Right now, it says 2529.482494 and it seems to grow up with about 30 bytes per second. But this algorithm gives some insight on how the storage will grow over time. The key is the CP array. The algorithm above tries to assume a linear growth between the three timestamps below, and interpolate between the associated capacities: 

var CP = [
 [ 1122879600000, 2450 ],
 [ 1125558000000, 2550 ],
 [ 1136102400000, 2950 ]
];

Which means, after a little reverse engineering, that at the first timestamp the size of the GMail mailbox will be 2450 MB, then 2550 MB, then 2950 MB. But what the timestaps are? Let's write a JScript small program to find out:

var d = new Date();
var t = d.getTime();

var CP = [
 [ 1122879600000, 2450 ],
 [ 1125558000000, 2550 ],
 [ 1136102400000, 2950 ]
];

for (i = 0; i < CP.length; i++) {
  d.setTime(CP[i][0]);
  WScript.Echo(d, " - ", CP[i][1], " MB ");
}

This displays the following:

Mon Aug 1 00:00:00 PDT 2005  -  2450  MB
Thu Sep 1 00:00:00 PDT 2005  -  2550  MB
Sun Jan 1 00:00:00 PST 2006  -  2950  MB

Which means that GMail will offer around 3 GB around Jan 1 2006.

Hmm... Interesting way for Google to expose their strategic GMail growth details in this way :-)