其他分享
首页 > 其他分享> > 测一下变量申请的速度

测一下变量申请的速度

作者:互联网

 

下面是测试用的代码:

 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
-----------------------------------------

 

标签:1749.897,变量,int,申请,long,Runing,ms,Time,速度
来源: https://www.cnblogs.com/marmot-cage/p/11391168.html