STL 效率测试报告

· · 个人记录

STL 效率测试报告

注意:markdown 与 \LaTeX 炸了属正常现象

0. 前言

STL,全称 Standard Template Library,是 C++ 独有的一个内置标准库。这其中包含了许多数据结构与函数,以下是对其性能的检测。

注意:

1. 基础数据结构

数据标准:2 \times 10^7

(1) 手写:

所耗时间:81\ \text{s}

(2) \operatorname{stack} & \operatorname{queue}

所耗时间:464\ \text{s}

(3) \operatorname{vector}

所耗时间:362\ \text{s}

2.中等数据结构

数据标准:5 \times 10^6

(1) \operatorname{priority} \operatorname{queue}

| 手写 | STL | STL + O2 | | :----------: | :----------: | :----------: | :--------:| | 40\text{s} | 403\text{s} | 40\text{s}|

(2) \text{multiset} & \text{set}

这俩玩意似乎比较鸡肋,然后跑得特别慢。

数据标准:1 \times 10^6

STL O2
741 \text{s} 221\text{s}

(3)