bekovski

cpp

Nov 6th, 2017
102
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.64 KB | None | 0 0
  1. #include "npc.h"
  2.  
  3. #include<ctime>
  4. #include<iostream>
  5.  
  6. using namespace std;
  7.  
  8. int main() {
  9.     char* memory = new char[10 * 1024 * 1024];
  10.     int endOfStack = 0;
  11.    
  12.     cout << sizeof(NPC) << endl;
  13.    
  14.     clock_t begin = clock();
  15.    
  16.     const int numNPCs = 10000; 
  17.     NPC** NPCs = new NPC*[sizeof(NPC) * numNPCs];
  18.     // NPC* NPCs[numNPCs];
  19.    
  20.     for(int i=0; i < numNPCs; ++i) {
  21.         // NPCs[i] = new NPC();    
  22.  
  23.         new (NPCs[i]) NPC();
  24.     }
  25.    
  26.     /**/
  27.     for(int i=0; i < numNPCs; ++i) {
  28.         NPCs[i]->update();  // :-/
  29.     }
  30.    
  31.     clock_t end = clock();
  32.     double elapsed_secs = double(end - begin) / CLOCKS_PER_SEC;
  33.    
  34.     cout << "elapsed time: " << elapsed_secs << endl;
  35. }
Advertisement
Add Comment
Please, Sign In to add comment