We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
1.5.8. HashMap 有哪几种常见的遍历方式?
此处引用公众号文章中, 对于parallelStream遍历方式的性能分析有误
先说结论, 存在阻塞时parallelStream性能最高, 非阻塞时parallelStream性能最低
当遍历不存在阻塞时, parallelStream的性能是最低的:
Benchmark Mode Cnt Score Error Units Test.entrySet avgt 5 288.651 ± 10.536 ns/op Test.keySet avgt 5 584.594 ± 21.431 ns/op Test.lambda avgt 5 221.791 ± 10.198 ns/op Test.parallelStream avgt 5 6919.163 ± 1116.139 ns/op
加入阻塞代码Thread.sleep(10)后, parallelStream的性能才是最高的:
Thread.sleep(10)
Benchmark Mode Cnt Score Error Units Test.entrySet avgt 5 1554828440.000 ± 23657748.653 ns/op Test.keySet avgt 5 1550612500.000 ± 6474562.858 ns/op Test.lambda avgt 5 1551065180.000 ± 19164407.426 ns/op Test.parallelStream avgt 5 186345456.667 ± 3210435.590 ns/op
The text was updated successfully, but these errors were encountered:
good
Sorry, something went wrong.
No branches or pull requests
1.5.8. HashMap 有哪几种常见的遍历方式?
此处引用公众号文章中, 对于parallelStream遍历方式的性能分析有误
先说结论, 存在阻塞时parallelStream性能最高, 非阻塞时parallelStream性能最低
当遍历不存在阻塞时, parallelStream的性能是最低的:
加入阻塞代码
Thread.sleep(10)
后, parallelStream的性能才是最高的:The text was updated successfully, but these errors were encountered: