1
}
执行结果
(Debug mode)
1
Vector Insertion at the end Process time:3.094 sec
2
List Insertion at the end Process time:10.205 sec
3
Insertion at the end : Vector wins
4
Vector Insertion anywhere Process time:5.548 sec
5
List Insertion anywhere Process time:0.01 sec
6
Insertion anywhere : List wins
7
Vector deletion anywhere Process time:4.756 sec
8
List deletion anywhere Process time:0.011 sec
9
Deletion anywhere : List wins
10
Vector non-sequential access Process time:0.11 sec
11
List non-sequential access Process time:21.12 sec
12
Non-sequential : Vector wins
2
3
4
5
6
7
8
9
10
11
12
(Release Mode)
1
Vector Insertion at the end Process time:0.06 sec
2
List Insertion at the end Process time:0.39 sec
3
Insertion at the end : Vector wins
4
Vector Insertion anywhere Process time:4.757 sec
5
List Insertion anywhere Process time:0 sec
6
Insertion anywhere : List wins
7
Vector deletion anywhere Process time:4.717 sec
8
List deletion anywhere Process time:0 sec
9
Deletion anywhere : List wins
10
Vector non-sequential access Process time:0 sec
11
List non-sequential access Process time:0.491 sec
12
Non-sequential : Vector wins
2
3
4
5
6
7
8
9
10
11
12
可见经过compiler优化后,速度差异非常明显。