Skip to content

Commit 0a583ad

Browse files
committed
魔法-修复
1 parent d624763 commit 0a583ad

File tree

1 file changed

+18
-1
lines changed

1 file changed

+18
-1
lines changed

ChaosCrystal/List循环性能.md

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,4 +128,21 @@ com.gcssloop.alltest I/Time: ForEach-LinkedList:5ms
128128

129129
## 总结:
130130

131-
推荐使用迭代器(Iterator)和ForEach遍历List,不要使用传统的For循环。
131+
### 性能比较:
132+
133+
测试处理10000条数据性能:
134+
135+
> 数值仅供参考,与运行环境相关,每次测试结果都可能稍有差别。
136+
137+
| 迭代方式 | ArrayList | LinkedList |
138+
| :--------: | :-------: | :--------: |
139+
| For循环 | 20ms | 648ms |
140+
| Iterator | 4ms | 6ms |
141+
| for-each循环 | 5ms | 5ms |
142+
143+
144+
145+
**推荐使用迭代器(Iterator)和ForEach遍历List,不要使用传统的For循环。**
146+
147+
148+

0 commit comments

Comments
 (0)