// Collection of code snippets by Arne Vajhøj 
// (likely posted to comp.os.vms/INFO-VAX, INFO-TPU, MACRO32, eksperten.dk, newz.dk, LinkedIn or other place sometime between 1990 and now) 
#include <iostream>
#include <vector>
#include <ctime>

using namespace std;

const int X = 640;
const int Y = 480;
const int N = 100;

static int a[X][Y];
static vector<vector<int> >v(X,vector<int>(Y));

int main()
{
   clock_t t1 = clock();
   for(int i = 0; i < N; i++)
   {
       for(int j = 0; j < X; j++)
       {
           for(int k = 0; k < Y; k++)
           {
               a[j][k] = i;
           }
       }
   }
   clock_t t2 = clock();
   cout << "2D array: " << (t2 - t1) << endl;
   clock_t t3 = clock();
   for(int i = 0; i < N; i++)
   {
       for(int j = 0; j < X; j++)
       {
           for(int k = 0; k < Y; k++)
           {
               v[j][k] = i;
           }
       }
   }
   clock_t t4 = clock();
   cout << "vector of vector: " << (t4 - t3) << endl;
   return 0;
}
