zoukankan      html  css  js  c++  java
  • 测一下变量申请的速度

    下面是测试用的代码:

     1 #include <bits/stdc++.h>
     2 
     3 using namespace std;
     4 
     5 int main(){
     6     cout<<"(Type)"<<endl;
     7     for(int i=1;i<=5e7;i++){
     8         (Type) a;
     9     }
    10 }

     结果:

    int
    -----------------------------------------
    Runing Time:    104.599ms
    -----------------------------------------
    long long
    -----------------------------------------
    Runing Time:    104.540ms
    -----------------------------------------
    vector<int>
    -----------------------------------------
    Runing Time:   1749.897ms
    -----------------------------------------
    deque<int>
    -----------------------------------------
    Runing Time:  14822.420ms
    -----------------------------------------
    queue<int>
    -----------------------------------------
    Runing Time:  38413.759ms
    -----------------------------------------
    map<int,int>
    -----------------------------------------
    Runing Time:   1571.477ms
    -----------------------------------------
    set<int>
    -----------------------------------------
    Runing Time:   1570.402ms
    -----------------------------------------
    list<int>
    -----------------------------------------
    Runing Time:   1482.101ms
    -----------------------------------------
  • 相关阅读:
    msp430项目编程57
    msp430项目编程56
    msp430项目编程55
    msp430项目编程54
    msp430项目编程53
    msp430项目编程52
    msp430项目编程51
    msp430项目编程50
    msp430项目编程47
    msp430项目编程46
  • 原文地址:https://www.cnblogs.com/marmot-cage/p/11391168.html
Copyright © 2011-2022 走看看