///////////////////////////////////////////////////////////////////////////// // heaps.cpp - test performance of heap allocations // // Jim Fawcett, CSE691 - SW Modeling & Analysis, Fall 2000 ///////////////////////////////////////////////////////////////////////////// // Platform: Dell XPS1000, Windows 2000 Professional, SP1 #include #include #include #include using namespace std; ///////////////////////////////////////////////////////////////////////////// // class with static char array class strArray { public: strArray() {} ~strArray() {} private: char array[1000]; }; ///////////////////////////////////////////////////////////////////////////// // class with dynamic char array class strDynArray { public: strDynArray(int n); ~strDynArray(); private: char *array; }; strDynArray::strDynArray(int n) { array = new char[n]; } strDynArray::~strDynArray() { delete [] array; } // ///////////////////////////////////////////////////////////////////////////// // test stub int main() { cout << "\n Testing Performance of Heap Allocations " << "\n=========================================\n"; const int N = 500000; clock_t tstart; int i; tstart = clock(); for(i=0;i