亚洲av成人无遮挡网站在线观看,少妇性bbb搡bbb爽爽爽,亚洲av日韩精品久久久久久,兔费看少妇性l交大片免费,无码少妇一区二区三区

  免費注冊 查看新帖 |

Chinaunix

  平臺 論壇 博客 文庫
123下一頁
最近訪問板塊 發(fā)新帖
查看: 6831 | 回復: 21
打印 上一主題 下一主題

[C++] C++ STL容器的Benchmark 以及我的測試結果 [復制鏈接]

論壇徽章:
0
跳轉到指定樓層
1 [收藏(0)] [報告]
發(fā)表于 2007-03-30 13:41 |只看該作者 |倒序瀏覽
歡迎大家比較各自的測試結果




  1. /* Standard Container Benchmark

  2. Version 0.9, May 23, 2003

  3. The primary purpose of this benchmark is to show how different standard
  4. containers are in terms of performance. We have observed that programmers
  5. often use sets, multisets, deques in the situations where sorted vectors
  6. are the optimal solutions. Similarly, programmers often choose lists simply
  7. because they do a few insertions and deletions without knowing that vectors
  8. are more efficient at that for small containers.

  9. Frequently, of course, performance does not matter,
  10. but it is important that programmers are aware of the consequences of their
  11. choices. We are not saying that only vectors should be used, there are
  12. cases when one really needs a more complicated data structure, but one needs to
  13. understand the price for additional functionality.

  14. The secondary purpose of the benchmark is to encourage compiler and library vendors to
  15. keep improving performance. For example, it is not acceptable that some compilers give
  16. you a sizable penalty for using vector iterators instead of pointer. It is also quite
  17. clear that  performance of other standard containers could be improved.

  18. The benchmark is doing the same task 7 times using different data structures:
  19. array, vector (using a pointer as iterator), vector (using the defailt cector iterator),
  20. list, deque, set and multiset. The task is to remove duplicates from a sequence of doubles.
  21. This is a simple test, but it illustrates the performance of containers.

  22. It is clear that the benchmark needs to be eventually extended
  23. to slists and even to hash-sets and hash-maps, but we decided that at present it
  24. should work only with the standard containers. As the standard grows, so can
  25. the benchmark. The additional benefit of not including hash based containers is
  26. that now all the test have identical asymptotic complexity and, even more
  27. importantly, do almost the same number of comparisons. The difference is only
  28. in data structure overhead and cache behavior.

  29. The number of times that a given test is run inversly proportional to NlogN where N is the
  30. size of the sequence.  This allows one to see how containers of different size behave.
  31. The instructive values used for the benchmark are: 10, 100, 1000, 10000, 100000, 1000000.

  32. The time taken for a run of the benchmark depends on the machine used, the compiler used,
  33. the compiler and optimizer settings used, as well as the standard library. Please note that
  34. the time taken could be several minutes - and much more if you use a slow debug mode.

  35. The output is a table where columns are separated by tabs and rows by newlines. This is
  36. barely ok for a human reader, but ideal for feeding into a program, such as a spreadsheet
  37. for display or analysis.

  38. If you want to add your own test of a container, add the name of your container to
  39. the "header string, write a test function like the existing ones, e.g. vector_test,
  40. and add a call of "run" for your test in "run_tests".


  41. Alex Stepanov
  42. stepanov@adobe.com

  43. Bjarne Stroustrup
  44. bs@cs.tamu.edu

  45. */

  46. #include <stddef.h>   // some older implementations lack <cstddef>
  47. #include <time.h>
  48. #include <math.h>
  49. #include <stdlib.h>

  50. #include <vector>
  51. #include <algorithm>
  52. #include <list>
  53. #include <deque>
  54. #include <set>

  55. #include <iostream>
  56. #include <iomanip>

  57. typedef double element_t;

  58. using namespace std;

  59. vector<double> result_times; // results are puched into this vector

  60. const char header[] =
  61. "\tarray"
  62. "\tvector with pointers"
  63. "\tvector with iterators"
  64. "\tdeque"
  65. "\tlist"
  66. "\tset"
  67. "\tmultiset";

  68. void do_head()
  69. {
  70.    cout << "size" << header << '\n';
  71. }

  72. int do_tail()
  73. {
  74.    // in case you want to stop for confirmation in a windows console application
  75.    //char c;
  76.    //cin >> c;
  77.    return 0;
  78. }

  79. void do_row(int size)
  80. {
  81.    cout << size;
  82.    cout << fixed << setprecision(2);
  83.    for (size_t i = 0; i < result_times.size(); ++i)
  84.       cout << '\t' << result_times[i];
  85.    cout << '\n';
  86. }


  87. clock_t start_time;

  88. inline void start_timer() { start_time = clock(); }

  89. inline double timer()
  90. {
  91.    clock_t end_time = clock();
  92.    return (end_time - start_time)/double(CLOCKS_PER_SEC);
  93. }

  94. typedef void(*Test)(element_t*, element_t*, int);
  95. void run(Test f, element_t* first, element_t* last, int number_of_times)
  96. {
  97.    start_timer();
  98.    while (number_of_times-- > 0) f(first,last,number_of_times);
  99.    result_times.push_back(timer());
  100. }

  101. void array_test(element_t* first, element_t* last, int number_of_times)
  102. {
  103.    element_t* array = new element_t[last - first];
  104.    copy(first, last, array);
  105.    sort(array, array + (last - first));
  106.    unique(array, array + (last - first));
  107.    delete [] array;     
  108. }

  109. void vector_pointer_test(element_t* first, element_t* last, int number_of_times)
  110. {
  111.    vector<element_t> container(first, last);
  112.    // &*container.begin() gets us a pointer to the first element
  113.    sort(&*container.begin(), &*container.end());
  114.    unique(&*container.begin(), &*container.end());
  115. }

  116. void vector_iterator_test(element_t* first, element_t* last, int number_of_times)
  117. {
  118.    vector<element_t> container(first, last);
  119.    sort(container.begin(), container.end());
  120.    unique(container.begin(), container.end());
  121. }

  122. void deque_test(element_t* first, element_t* last, int number_of_times)
  123. {  
  124.    //       deque<element_t> container(first, last); CANNOT BE USED BECAUSE OF MVC++ 6
  125.    deque<element_t> container(size_t(last - first), 0.0);
  126.    copy(first, last, container.begin());
  127.    sort(container.begin(), container.end());
  128.    unique(container.begin(), container.end());
  129. }

  130. void list_test(element_t* first, element_t* last, int number_of_times)
  131. {
  132.    list<element_t> container(first, last);
  133.    container.sort();
  134.    container.unique();
  135. }

  136. void set_test(element_t* first, element_t* last, int number_of_times)
  137. {
  138.    set<element_t> container(first, last);
  139. }

  140. void multiset_test(element_t* first, element_t* last, int number_of_times)
  141. {
  142.    multiset<element_t> container(first, last);
  143.    typedef multiset<element_t>::iterator iterator;
  144.    {
  145.       iterator first = container.begin();
  146.       iterator last = container.end();

  147.       while (first != last) {
  148.          iterator next = first;
  149.          if (++next == last) break;
  150.          if (*first == *next)
  151.             container.erase(next);
  152.          else
  153.             ++first;
  154.       }
  155.    }
  156. }

  157. void initialize(element_t* first, element_t* last)
  158. {
  159.    element_t value = 0.0;
  160.    while (first != last) {
  161.       *first++ = value;
  162.       value += 1.;
  163.    }
  164. }

  165. double logtwo(double x)
  166. {
  167.    return log(x)/log((double) 2.0);
  168. }

  169. const int largest_size = 1000000;

  170. int number_of_tests(int size) {
  171.    double n = size;
  172.    double largest_n = largest_size;
  173.    return int(floor((largest_n * logtwo(largest_n)) / (n * logtwo(n))));
  174. }

  175. void run_tests(int size)
  176. {
  177.    const int n = number_of_tests(size);
  178.    const size_t length = 2*size;
  179.    result_times.clear();

  180.    // make a random test set of the chosen size:
  181.    vector<element_t> buf(length);
  182.    element_t* buffer = &buf[0];
  183.    element_t* buffer_end = &buf[length];
  184.    initialize(buffer, buffer + size);      // elements
  185.    initialize(buffer + size, buffer_end);   // duplicate elements
  186.    random_shuffle(buffer, buffer_end);

  187.    // test the containers:
  188.    run(array_test, buffer, buffer_end, n);
  189.    run(vector_pointer_test, buffer, buffer_end, n);
  190.    run(vector_iterator_test, buffer, buffer_end, n);
  191.    run(deque_test, buffer, buffer_end, n);
  192.    run(list_test, buffer, buffer_end, n);
  193.    run(set_test, buffer, buffer_end, n);
  194.    run(multiset_test, buffer, buffer_end, n);
  195.    do_row(size);
  196. }

  197. int main()
  198. {
  199.    do_head();
  200.    const int sizes [] = {10, 100, 1000, 10000, 100000, 1000000};
  201.    const int n = sizeof(sizes)/sizeof(int);
  202.    for (int i = 0; i < n; ++i) run_tests(sizes[i]);
  203.    return do_tail();
  204. }

復制代碼





我的機器Celeron(R) CPU 2.53GHz, Mem 256M, FreeBSD 6.2
g++ version 3.4.6
編譯選項 -O3 -march=i686

size    array   vector with pointers    vector with iterators   deque   list    set     multiset
10      0.57    0.56    0.61    1.47    3.80    2.20    4.06
100     0.38    0.39    0.36    0.86    2.32    1.62    2.53
1000    0.62    0.62    0.64    0.88    1.94    1.53    2.12
10000   0.69    0.70    0.71    0.86    2.21    1.98    3.71
100000  0.66    0.66    0.67    0.86    4.17    4.65    7.93
1000000 0.64    0.64    0.66    0.83    9.52    10.31   27.90

論壇徽章:
0
2 [報告]
發(fā)表于 2007-03-30 14:20 |只看該作者
同樣的機器Celeron(R) CPU 2.53GHz, Mem 256M WindowsXP
Visual C++ 6.0
Release 速度最大優(yōu)化

size    array   vector with pointers    vector with iterators   deque   list set     multiset
10      0.80    0.63    0.63    1.49    5.70    2.39    4.59
100     0.45    0.47    0.45    1.19    2.75    1.69    2.88
1000    0.70    0.69    0.69    1.20    2.34    1.56    2.63
10000   0.75    0.72    0.69    1.23    4.24    2.48    4.44
100000  0.70    0.70    0.72    1.20    4.69    4.56    6.58
1000000 0.70    0.69    0.69    1.16    14.17   5.91    8.06



而相同機器Visual C++ 7.1
Release 速度最大優(yōu)化
size    array   vector with pointers    vector with iterators   deque   list set     multiset
10      1.64    1.67    1.83    5.56    13.33   3.36    6.83
100     0.98    0.98    1.11    3.28    4.45    2.05    3.73
1000    1.03    1.05    1.13    2.72    3.30    1.83    3.53
10000   1.02    1.00    1.06    2.77    4.22    2.81    6.00
100000  0.98    1.00    1.09    2.58    5.39    5.00    7.48
1000000 1.00    0.98    1.02    2.42    5.91    6.28    8.73



相比之下,Microsoft 的編譯器在multiset1000000時速度比較快,總體比較慢。VC++7.1更平均些。

論壇徽章:
0
3 [報告]
發(fā)表于 2007-03-30 14:31 |只看該作者
同時也可以看出MicrosoftVC在set和Multiset數(shù)據(jù)類型上效率比較高,可能是實現(xiàn)上比較好;
而在其他容器類型上與g++相比效率不足。

論壇徽章:
0
4 [報告]
發(fā)表于 2007-03-30 15:59 |只看該作者
支持樓主,完了我找個環(huán)境也測試一下。、

論壇徽章:
0
5 [報告]
發(fā)表于 2007-03-30 16:16 |只看該作者
偶也運行了一下:

  1. size    array   vector with pointers    vector with iterators   deque   list    set     multiset
  2. 10      0.76    0.76    0.74    1.20    3.72    2.14    3.56
  3. 100     0.53    0.53    0.52    0.77    1.96    1.38    2.10
  4. 1000    0.48    0.48    0.47    0.68    1.57    1.10    1.60
  5. 10000   0.46    0.46    0.45    0.63    1.54    1.10    1.53
  6. 100000  0.47    0.47    0.46    0.65    3.08    1.98    3.74
  7. 1000000 0.59    0.59    0.58    0.78    3.52    5.30    6.03
復制代碼


CPU是

  1. processor  : 0
  2. vendor     : GenuineIntel
  3. arch       : IA-64
  4. family     : 32
  5. model      : 0
  6. revision   : 7
  7. archrev    : 0
  8. features   : branchlong, 16-byte atomic ops
  9. cpu number : 0
  10. cpu regs   : 4
  11. cpu MHz    : 1594.000007
  12. itc MHz    : 399.000000
  13. BogoMIPS   : 3186.68
  14. siblings   : 2
  15. physical id: 4096
  16. core id    : 0
  17. thread id  : 0
復制代碼

論壇徽章:
0
6 [報告]
發(fā)表于 2007-03-30 16:21 |只看該作者
emacsnw的效率真高,不愧是64位的機器。

而網(wǎng)友feishq00的機器也是64位,效率次之。
HPC 3000/400/512M
aCC: HP ANSI C++ B3910B A.03.13
aCC -O優(yōu)化
size    array   vector with pointers    vector with iterators   deque   list    set     multiset
10      3.4     3.5     3.5     11      2.1e+02 14      18
100     1.6     1.6     1.7     5.1     23      5.6     8
1000    1.4     1.4     1.4     4       13      4.3     6
10000   1.3     1.3     1.3     3.6     12      3.8     5
100000  1.4     1.4     1.4     3.6     13      5       7.2
1000000 1.6     1.6     1.6     3.6     13      8.4     12

[ 本帖最后由 doctorjxd 于 2007-3-30 16:24 編輯 ]

論壇徽章:
0
7 [報告]
發(fā)表于 2007-03-30 16:22 |只看該作者
有沒測以下stlport在vc下的效率?

論壇徽章:
0
8 [報告]
發(fā)表于 2007-03-30 17:00 |只看該作者
原帖由 飛灰橙 于 2007-3-30 16:22 發(fā)表
有沒測以下stlport在vc下的效率?


我沒有測試,據(jù)說
http://www.stlchina.org/twiki/bin/view.pl/Main/STLEasyStudy
STLport已經(jīng)被C/C++技術委員會接受成為工業(yè)標準,且在許多平臺上都支持。根據(jù)測試STLport的效率比VC中的STL要快。

論壇徽章:
0
9 [報告]
發(fā)表于 2012-08-20 13:37 |只看該作者
本帖最后由 fiendcly 于 2012-08-20 13:40 編輯

哇這篇文章好久了..

剛好在找 相關的測試工具 :

收下囉!!!

執(zhí)行結果....
  1. [root@FIEND test]# ./stl_banckmark
  2. size    array   vector with pointers    vector with iterators   deque   list    set     multiset
  3. 10      0.19    0.22    0.20    0.38    1.35    0.65    1.22
  4. 100     0.09    0.10    0.09    0.17    0.68    0.41    0.70
  5. 1000    0.23    0.23    0.24    0.33    0.73    0.65    0.93
  6. 10000   0.28    0.29    0.29    0.35    0.90    0.84    1.17
  7. 100000  0.28    0.28    0.28    0.33    1.31    1.25    1.63
  8. 1000000 0.27    0.28    0.28    0.33    1.52    2.23    2.85
復制代碼
阿娘喂!! 我只能說現(xiàn)在的機器跟五年前的比起來...

簡值是坐穿梭機...................




CPU :
  1. [root@FIEND test]# cat /proc/cpuinfo
  2. processor       : 0
  3. vendor_id       : GenuineIntel
  4. cpu family      : 6
  5. model           : 45
  6. model name      : Intel(R) Xeon(R) CPU E5-2620 0 @ 2.00GHz
  7. stepping        : 7
  8. cpu MHz         : 1995.192
  9. cache size      : 15360 KB
  10. physical id     : 0
  11. siblings        : 6
  12. core id         : 0
  13. cpu cores       : 6
  14. apicid          : 0
  15. initial apicid  : 0
  16. fpu             : yes
  17. fpu_exception   : yes
  18. cpuid level     : 13
  19. wp              : yes
  20. flags           : fpu vme de pse tsc msr pae mce cx8 apic mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht syscall nx rdtscp lm constant_tsc arch_perfmon pebs bts xtopology tsc_reliable nonstop_tsc aperfmperf unfair_spinlock pni pclmulqdq ssse3 cx16 sse4_1 sse4_2 popcnt aes xsave avx hypervisor lahf_lm ida arat epb xsaveopt pln pts dts
  21. bogomips        : 3990.38
  22. clflush size    : 64
  23. cache_alignment : 64
  24. address sizes   : 40 bits physical, 48 bits virtual
  25. power management:

  26. processor       : 1
  27. vendor_id       : GenuineIntel
  28. cpu family      : 6
  29. model           : 45
  30. model name      : Intel(R) Xeon(R) CPU E5-2620 0 @ 2.00GHz
  31. stepping        : 7
  32. cpu MHz         : 1995.192
  33. cache size      : 15360 KB
  34. physical id     : 0
  35. siblings        : 6
  36. core id         : 1
  37. cpu cores       : 6
  38. apicid          : 1
  39. initial apicid  : 1
  40. fpu             : yes
  41. fpu_exception   : yes
  42. cpuid level     : 13
  43. wp              : yes
  44. flags           : fpu vme de pse tsc msr pae mce cx8 apic mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht syscall nx rdtscp lm constant_tsc arch_perfmon pebs bts xtopology tsc_reliable nonstop_tsc aperfmperf unfair_spinlock pni pclmulqdq ssse3 cx16 sse4_1 sse4_2 popcnt aes xsave avx hypervisor lahf_lm ida arat epb xsaveopt pln pts dts
  45. bogomips        : 3990.38
  46. clflush size    : 64
  47. cache_alignment : 64
  48. address sizes   : 40 bits physical, 48 bits virtual
  49. power management:

  50. processor       : 2
  51. vendor_id       : GenuineIntel
  52. cpu family      : 6
  53. model           : 45
  54. model name      : Intel(R) Xeon(R) CPU E5-2620 0 @ 2.00GHz
  55. stepping        : 7
  56. cpu MHz         : 1995.192
  57. cache size      : 15360 KB
  58. physical id     : 0
  59. siblings        : 6
  60. core id         : 2
  61. cpu cores       : 6
  62. apicid          : 2
  63. initial apicid  : 2
  64. fpu             : yes
  65. fpu_exception   : yes
  66. cpuid level     : 13
  67. wp              : yes
  68. flags           : fpu vme de pse tsc msr pae mce cx8 apic mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht syscall nx rdtscp lm constant_tsc arch_perfmon pebs bts xtopology tsc_reliable nonstop_tsc aperfmperf unfair_spinlock pni pclmulqdq ssse3 cx16 sse4_1 sse4_2 popcnt aes xsave avx hypervisor lahf_lm ida arat epb xsaveopt pln pts dts
  69. bogomips        : 3990.38
  70. clflush size    : 64
  71. cache_alignment : 64
  72. address sizes   : 40 bits physical, 48 bits virtual
  73. power management:

  74. processor       : 3
  75. vendor_id       : GenuineIntel
  76. cpu family      : 6
  77. model           : 45
  78. model name      : Intel(R) Xeon(R) CPU E5-2620 0 @ 2.00GHz
  79. stepping        : 7
  80. cpu MHz         : 1995.192
  81. cache size      : 15360 KB
  82. physical id     : 0
  83. siblings        : 6
  84. core id         : 3
  85. cpu cores       : 6
  86. apicid          : 3
  87. initial apicid  : 3
  88. fpu             : yes
  89. fpu_exception   : yes
  90. cpuid level     : 13
  91. wp              : yes
  92. flags           : fpu vme de pse tsc msr pae mce cx8 apic mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht syscall nx rdtscp lm constant_tsc arch_perfmon pebs bts xtopology tsc_reliable nonstop_tsc aperfmperf unfair_spinlock pni pclmulqdq ssse3 cx16 sse4_1 sse4_2 popcnt aes xsave avx hypervisor lahf_lm ida arat epb xsaveopt pln pts dts
  93. bogomips        : 3990.38
  94. clflush size    : 64
  95. cache_alignment : 64
  96. address sizes   : 40 bits physical, 48 bits virtual
  97. power management:

  98. processor       : 4
  99. vendor_id       : GenuineIntel
  100. cpu family      : 6
  101. model           : 45
  102. model name      : Intel(R) Xeon(R) CPU E5-2620 0 @ 2.00GHz
  103. stepping        : 7
  104. cpu MHz         : 1995.192
  105. cache size      : 15360 KB
  106. physical id     : 0
  107. siblings        : 6
  108. core id         : 4
  109. cpu cores       : 6
  110. apicid          : 4
  111. initial apicid  : 4
  112. fpu             : yes
  113. fpu_exception   : yes
  114. cpuid level     : 13
  115. wp              : yes
  116. flags           : fpu vme de pse tsc msr pae mce cx8 apic mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht syscall nx rdtscp lm constant_tsc arch_perfmon pebs bts xtopology tsc_reliable nonstop_tsc aperfmperf unfair_spinlock pni pclmulqdq ssse3 cx16 sse4_1 sse4_2 popcnt aes xsave avx hypervisor lahf_lm ida arat epb xsaveopt pln pts dts
  117. bogomips        : 3990.38
  118. clflush size    : 64
  119. cache_alignment : 64
  120. address sizes   : 40 bits physical, 48 bits virtual
  121. power management:

  122. processor       : 5
  123. vendor_id       : GenuineIntel
  124. cpu family      : 6
  125. model           : 45
  126. model name      : Intel(R) Xeon(R) CPU E5-2620 0 @ 2.00GHz
  127. stepping        : 7
  128. cpu MHz         : 1995.192
  129. cache size      : 15360 KB
  130. physical id     : 0
  131. siblings        : 6
  132. core id         : 5
  133. cpu cores       : 6
  134. apicid          : 5
  135. initial apicid  : 5
  136. fpu             : yes
  137. fpu_exception   : yes
  138. cpuid level     : 13
  139. wp              : yes
  140. flags           : fpu vme de pse tsc msr pae mce cx8 apic mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht syscall nx rdtscp lm constant_tsc arch_perfmon pebs bts xtopology tsc_reliable nonstop_tsc aperfmperf unfair_spinlock pni pclmulqdq ssse3 cx16 sse4_1 sse4_2 popcnt aes xsave avx hypervisor lahf_lm ida arat epb xsaveopt pln pts dts
  141. bogomips        : 3990.38
  142. clflush size    : 64
  143. cache_alignment : 64
  144. address sizes   : 40 bits physical, 48 bits virtual
  145. power management:

  146. processor       : 6
  147. vendor_id       : GenuineIntel
  148. cpu family      : 6
  149. model           : 45
  150. model name      : Intel(R) Xeon(R) CPU E5-2620 0 @ 2.00GHz
  151. stepping        : 7
  152. cpu MHz         : 1995.192
  153. cache size      : 15360 KB
  154. physical id     : 1
  155. siblings        : 6
  156. core id         : 0
  157. cpu cores       : 6
  158. apicid          : 8
  159. initial apicid  : 8
  160. fpu             : yes
  161. fpu_exception   : yes
  162. cpuid level     : 13
  163. wp              : yes
  164. flags           : fpu vme de pse tsc msr pae mce cx8 apic mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht syscall nx rdtscp lm constant_tsc arch_perfmon pebs bts xtopology tsc_reliable nonstop_tsc aperfmperf unfair_spinlock pni pclmulqdq ssse3 cx16 sse4_1 sse4_2 popcnt aes xsave avx hypervisor lahf_lm ida arat epb xsaveopt pln pts dts
  165. bogomips        : 3990.38
  166. clflush size    : 64
  167. cache_alignment : 64
  168. address sizes   : 40 bits physical, 48 bits virtual
  169. power management:

  170. processor       : 7
  171. vendor_id       : GenuineIntel
  172. cpu family      : 6
  173. model           : 45
  174. model name      : Intel(R) Xeon(R) CPU E5-2620 0 @ 2.00GHz
  175. stepping        : 7
  176. cpu MHz         : 1995.192
  177. cache size      : 15360 KB
  178. physical id     : 1
  179. siblings        : 6
  180. core id         : 1
  181. cpu cores       : 6
  182. apicid          : 9
  183. initial apicid  : 9
  184. fpu             : yes
  185. fpu_exception   : yes
  186. cpuid level     : 13
  187. wp              : yes
  188. flags           : fpu vme de pse tsc msr pae mce cx8 apic mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht syscall nx rdtscp lm constant_tsc arch_perfmon pebs bts xtopology tsc_reliable nonstop_tsc aperfmperf unfair_spinlock pni pclmulqdq ssse3 cx16 sse4_1 sse4_2 popcnt aes xsave avx hypervisor lahf_lm ida arat epb xsaveopt pln pts dts
  189. bogomips        : 3990.38
  190. clflush size    : 64
  191. cache_alignment : 64
  192. address sizes   : 40 bits physical, 48 bits virtual
  193. power management:

  194. processor       : 8
  195. vendor_id       : GenuineIntel
  196. cpu family      : 6
  197. model           : 45
  198. model name      : Intel(R) Xeon(R) CPU E5-2620 0 @ 2.00GHz
  199. stepping        : 7
  200. cpu MHz         : 1995.192
  201. cache size      : 15360 KB
  202. physical id     : 1
  203. siblings        : 6
  204. core id         : 2
  205. cpu cores       : 6
  206. apicid          : 10
  207. initial apicid  : 10
  208. fpu             : yes
  209. fpu_exception   : yes
  210. cpuid level     : 13
  211. wp              : yes
  212. flags           : fpu vme de pse tsc msr pae mce cx8 apic mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht syscall nx rdtscp lm constant_tsc arch_perfmon pebs bts xtopology tsc_reliable nonstop_tsc aperfmperf unfair_spinlock pni pclmulqdq ssse3 cx16 sse4_1 sse4_2 popcnt aes xsave avx hypervisor lahf_lm ida arat epb xsaveopt pln pts dts
  213. bogomips        : 3990.38
  214. clflush size    : 64
  215. cache_alignment : 64
  216. address sizes   : 40 bits physical, 48 bits virtual
  217. power management:

  218. processor       : 9
  219. vendor_id       : GenuineIntel
  220. cpu family      : 6
  221. model           : 45
  222. model name      : Intel(R) Xeon(R) CPU E5-2620 0 @ 2.00GHz
  223. stepping        : 7
  224. cpu MHz         : 1995.192
  225. cache size      : 15360 KB
  226. physical id     : 1
  227. siblings        : 6
  228. core id         : 3
  229. cpu cores       : 6
  230. apicid          : 11
  231. initial apicid  : 11
  232. fpu             : yes
  233. fpu_exception   : yes
  234. cpuid level     : 13
  235. wp              : yes
  236. flags           : fpu vme de pse tsc msr pae mce cx8 apic mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht syscall nx rdtscp lm constant_tsc arch_perfmon pebs bts xtopology tsc_reliable nonstop_tsc aperfmperf unfair_spinlock pni pclmulqdq ssse3 cx16 sse4_1 sse4_2 popcnt aes xsave avx hypervisor lahf_lm ida arat epb xsaveopt pln pts dts
  237. bogomips        : 3990.38
  238. clflush size    : 64
  239. cache_alignment : 64
  240. address sizes   : 40 bits physical, 48 bits virtual
  241. power management:

  242. processor       : 10
  243. vendor_id       : GenuineIntel
  244. cpu family      : 6
  245. model           : 45
  246. model name      : Intel(R) Xeon(R) CPU E5-2620 0 @ 2.00GHz
  247. stepping        : 7
  248. cpu MHz         : 1995.192
  249. cache size      : 15360 KB
  250. physical id     : 1
  251. siblings        : 6
  252. core id         : 4
  253. cpu cores       : 6
  254. apicid          : 12
  255. initial apicid  : 12
  256. fpu             : yes
  257. fpu_exception   : yes
  258. cpuid level     : 13
  259. wp              : yes
  260. flags           : fpu vme de pse tsc msr pae mce cx8 apic mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht syscall nx rdtscp lm constant_tsc arch_perfmon pebs bts xtopology tsc_reliable nonstop_tsc aperfmperf unfair_spinlock pni pclmulqdq ssse3 cx16 sse4_1 sse4_2 popcnt aes xsave avx hypervisor lahf_lm ida arat epb xsaveopt pln pts dts
  261. bogomips        : 3990.38
  262. clflush size    : 64
  263. cache_alignment : 64
  264. address sizes   : 40 bits physical, 48 bits virtual
  265. power management:

  266. processor       : 11
  267. vendor_id       : GenuineIntel
  268. cpu family      : 6
  269. model           : 45
  270. model name      : Intel(R) Xeon(R) CPU E5-2620 0 @ 2.00GHz
  271. stepping        : 7
  272. cpu MHz         : 1995.192
  273. cache size      : 15360 KB
  274. physical id     : 1
  275. siblings        : 6
  276. core id         : 5
  277. cpu cores       : 6
  278. apicid          : 13
  279. initial apicid  : 13
  280. fpu             : yes
  281. fpu_exception   : yes
  282. cpuid level     : 13
  283. wp              : yes
  284. flags           : fpu vme de pse tsc msr pae mce cx8 apic mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht syscall nx rdtscp lm constant_tsc arch_perfmon pebs bts xtopology tsc_reliable nonstop_tsc aperfmperf unfair_spinlock pni pclmulqdq ssse3 cx16 sse4_1 sse4_2 popcnt aes xsave avx hypervisor lahf_lm ida arat epb xsaveopt pln pts dts
  285. bogomips        : 3990.38
  286. clflush size    : 64
  287. cache_alignment : 64
  288. address sizes   : 40 bits physical, 48 bits virtual
  289. power management:
復制代碼

論壇徽章:
1
射手座
日期:2013-08-21 13:11:46
10 [報告]
發(fā)表于 2012-08-20 14:03 |只看該作者
本帖最后由 egmkang 于 2012-08-20 14:07 編輯

gcc 4.6.3

  1. size    array   vector with pointers    vector with iterators   deque   list    set     multiset
  2. 10      0.13    0.11    0.11    0.28    0.85    0.39    0.71
  3. 100     0.06    0.06    0.06    0.13    0.44    0.25    0.44
  4. 1000    0.15    0.15    0.14    0.24    0.45    0.39    0.56
  5. 10000   0.18    0.18    0.18    0.25    0.52    0.49    0.69
  6. 100000  0.18    0.18    0.17    0.24    1.19    0.92    1.53
  7. 1000000 0.17    0.18    0.18    0.24    1.27    1.98    2.49
復制代碼
clang 3.1
  1. size    array   vector with pointers    vector with iterators   deque   list    set     multiset
  2. 10      0.12    0.10    0.12    0.25    0.77    0.44    0.72
  3. 100     0.06    0.06    0.06    0.11    0.45    0.34    0.50
  4. 1000    0.16    0.17    0.15    0.23    0.47    0.42    0.54
  5. 10000   0.18    0.18    0.17    0.23    0.54    0.50    0.65
  6. 100000  0.17    0.18    0.17    0.22    1.21    0.91    1.49
  7. 1000000 0.18    0.17    0.18    0.22    1.28    2.12    2.59
復制代碼
兩個都鏈接了jemalloc,都是-O2 -g

cpuinfo(虛擬機里面運行的....沒辦法撒,沒條件啊)

  1. processor       : 0
  2. vendor_id       : GenuineIntel
  3. cpu family      : 6
  4. model           : 42
  5. model name      : Intel(R) Core(TM) i5-2400 CPU @ 3.10GHz
  6. stepping        : 7
  7. cpu MHz         : 3070.411
  8. cache size      : 6144 KB
  9. physical id     : 0
  10. siblings        : 4
  11. core id         : 0
  12. cpu cores       : 4
  13. apicid          : 0
  14. initial apicid  : 0
  15. fpu             : yes
  16. fpu_exception   : yes
  17. cpuid level     : 5
  18. wp              : yes
  19. flags           : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 ht syscall nx lm constant_tsc rep_good nopl pni ssse3 lahf_lm
  20. bogomips        : 6140.82
  21. clflush size    : 64
  22. cache_alignment : 64
  23. address sizes   : 36 bits physical, 48 bits virtual
  24. power management:
復制代碼
您需要登錄后才可以回帖 登錄 | 注冊

本版積分規(guī)則 發(fā)表回復

  

北京盛拓優(yōu)訊信息技術有限公司. 版權所有 京ICP備16024965號-6 北京市公安局海淀分局網(wǎng)監(jiān)中心備案編號:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年舉報專區(qū)
中國互聯(lián)網(wǎng)協(xié)會會員  聯(lián)系我們:huangweiwei@itpub.net
感謝所有關心和支持過ChinaUnix的朋友們 轉載本站內(nèi)容請注明原作者名及出處

清除 Cookies - ChinaUnix - Archiver - WAP - TOP