Guest User

Untitled

a guest
Jun 22nd, 2018
83
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.53 KB | None | 0 0
  1. #include <vector>
  2. #include <iostream>
  3. #include <ctime>
  4. using namespace std;;
  5.  
  6.  
  7. int main() {
  8. vector <int> v;
  9. const int BIG = 10000000;
  10. for ( int i = 0; i < BIG; i++ ) {
  11. v.push_back( i );
  12. }
  13. cout << "beginn";
  14. int n = 0;
  15. time_t now = time(0);
  16. for ( int a = 0; a < 10; a++ ) {
  17. for( vector <int>::iterator it = v.begin(); it != v.end(); ++it ) {
  18. n += *it;
  19. }
  20. }
  21. cout << time(0) - now << "n";
  22. now = time(0);
  23. for ( int a = 0; a < 10; a++ ) {
  24. for( vector <int>::const_iterator cit = v.begin(); cit != v.end(); ++cit ) {
  25. n += *cit;
  26. }
  27. }
  28. cout << time(0) - now << "n";;
  29.  
  30. return n != 0;
  31.  
  32. }
  33.  
  34. call clock_gettime
  35. movl 56(%esp), %esi
  36. movl $10, %ecx
  37. movl 60(%esp), %edx
  38. .p2align 4,,7
  39. .p2align 3
  40. .L35:
  41. cmpl %esi, %edx
  42. je .L33
  43. movl %esi, %eax .p2align 4,,7
  44. .p2align 3
  45. .L34:
  46. addl (%eax), %ebx
  47. addl $4, %eax
  48. cmpl %eax, %edx
  49. jne .L34
  50. .L33:
  51. subl $1, %ecx
  52. jne .L35
  53. leal 68(%esp), %edx
  54. movl %edx, 4(%esp)
  55. leal 56(%esp), %esi
  56. movl $1, (%esp)
  57.  
  58. movl 60(%esp), %edx
  59. movl $10, %ecx
  60. movl 56(%esp), %esi
  61. .p2align 4,,7
  62. .p2align 3
  63. .L38:
  64. cmpl %esi, %edx
  65. je .L36
  66. movl %esi, %eax
  67. .p2align 4,,7
  68. .p2align 3
  69. .L37:
  70. addl (%eax), %ebx
  71. addl $4, %eax
  72. cmpl %eax, %edx
  73. jne .L37
  74. .L36:
  75. subl $1, %ecx
  76. jne .L38
  77. leal 68(%esp), %edx
  78. movl %edx, 4(%esp)
  79. leal 56(%esp), %esi
  80. movl $1, (%esp)
Add Comment
Please, Sign In to add comment