Skip to content

2014/08/compare-sort/ #2

New issue

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

Open
utterances-bot opened this issue Jan 22, 2022 · 1 comment
Open

2014/08/compare-sort/ #2

utterances-bot opened this issue Jan 22, 2022 · 1 comment

Comments

@utterances-bot
Copy link

排序方案速度测试 | 子勤的博客

看书的时候时不时会遇到对各种排序算法的介绍。有这么多排序算法,在比赛中一般用哪种会比较好?一方面想着,“快排大法好!现成不用码!”但又听说有的数据会专门卡快排。而且,快排真的有那么快吗?种种顾虑涌上心头。所以,今天晚上我决

https://blog.wangziq.in/2014/08/compare-sort/

Copy link

C++的std::sort函数的性能对编译选项有较高的依赖性:
在编译优化程度是不优化或者O(1)的时候,C++的std::sort性能甚至不如Java的库函数Arrays.sort(本质上是TimSort,优化后快排)
在编译优化程度是O(2)的时候,C++的std::sort虽然可以击败Arrays.sort,但仍然不敌Arrays.parallelSort(本质上是基于ForkJoin池的多核心排序)
在编译优化程度是O(3)的时候,C++的std::sort才能够彻底战胜Java的自带排序库

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants