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