From ca113e93368ee3775514bed9eafcecbb7100a65a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=82=B9=E6=99=93=E8=88=AA?= <1210603696@qq.com> Date: Fri, 6 Feb 2015 16:02:02 +0800 Subject: [PATCH] --- README.md | 27 ++++++++++++++++++++++++++- 1 file changed, 26 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index e9cca2e..2316c53 100644 --- a/README.md +++ b/README.md @@ -69,6 +69,7 @@ TinySTL * is_permutation:100% * search:100% * advance:100% + * sort:100% * 其他组件: * circular_buffer:100% * bitmap:100% @@ -412,4 +413,28 @@ TinySTL |TinySTL::unordered_set<int>|100万/100亿|1214|9546| |std::unordered_set<int>|1万/1亿|64|101| |std::unordered_set<int>|10万/10亿|884|953| -|std::unordered_set<int>|100万/100亿|2781|9682| \ No newline at end of file +|std::unordered_set<int>|100万/100亿|2781|9682| + + + + +####(4):sort + + std::random_device rd; + const int len = 10000000; + int arr[len]; + std::generate(std::begin(arr), std::end(arr), [&rd](){return rd(); }); + ProfilerInstance::start(); + TinySTL::sort(std::begin(arr), std::end(arr)); + //std::sort(std::begin(arr), std::end(arr)); + ProfilerInstance::finish(); + ProfilerInstance::dumpDuringTime(); + +|algorithm|quantity|time(ms)| +|---------|--------|--------| +|TinySTL::sort|10万|11| +|TinySTL::sort|100万|133| +|TinySTL::sort|1000万|1547| +|std::sort|10万|13| +|std::sort|100万|147| +|std::sort|1000万|1730| \ No newline at end of file