fork(1) download
  1. #include <iostream>
  2. #include <chrono>
  3.  
  4. using namespace std;
  5.  
  6. int main() {
  7. int *array = new int[1000000];
  8. auto b = chrono::high_resolution_clock::now();
  9. for(int i = 0; i < 1000000; ++i) {
  10. new(reinterpret_cast<char*>(array+i))int(i);
  11. }
  12. auto e = chrono::high_resolution_clock::now();
  13. std::cout << chrono::duration<double>(e-b).count() << std::endl;
  14. return 0;
  15. }
Success #stdin #stdout 0s 19144KB
stdin
Standard input is empty
stdout
0.00114064