mirror of
https://github.com/KaiserY/trpl-zh-cn
synced 2025-02-22 20:22:18 +08:00
Merge pull request #61 from showerMuggle/patch-3
Update ch13-04-performance.md
This commit is contained in:
commit
2b2e4502c9
@ -4,8 +4,6 @@
|
||||
> <br>
|
||||
> commit 009fffa4580ffb175f1b8470b5b12e4a63d670e4
|
||||
|
||||
为了决定使用循环还是迭代器,我们需要指导哪个实现更快一些:是显式循环版本的 `search` 函数还是迭代器版本的。
|
||||
|
||||
为了决定使用哪个实现,我们需要知道哪个版本的 `search` 函数更快一些:是直接使用 `for` 循环的版本还是使用迭代器的版本。
|
||||
|
||||
我们运行了一个性能测试,通过将阿瑟·柯南·道尔的“福尔摩斯探案集”的全部内容加载进 `String` 并寻找其中的单词 “the”。如下是 `for` 循环版本和迭代器版本的 `search` 函数的性能测试结果:
|
||||
|
Loading…
Reference in New Issue
Block a user