[Groonga-commit] groonga/grnxx at 1375d63 [master] Add a benchmark for incremental sorting. (#42)

Back to archive index

susumu.yata null+****@clear*****
Thu Dec 11 14:37:15 JST 2014


susumu.yata	2014-12-11 14:37:15 +0900 (Thu, 11 Dec 2014)

  New Revision: 1375d63c73cf4a79b2a97a634602d85104417c2e
  https://github.com/groonga/grnxx/commit/1375d63c73cf4a79b2a97a634602d85104417c2e

  Message:
    Add a benchmark for incremental sorting. (#42)

  Modified files:
    benchmark/benchmark_sorter.cpp

  Modified: benchmark/benchmark_sorter.cpp (+18 -3)
===================================================================
--- benchmark/benchmark_sorter.cpp    2014-12-11 13:29:09 +0900 (dca8475)
+++ benchmark/benchmark_sorter.cpp    2014-12-11 14:37:15 +0900 (0967f55)
@@ -141,8 +141,12 @@ grnxx::Array<grnxx::Record> create_records(grnxx::Table *table) {
   return records;
 }
 
-void benchmark_row_id(grnxx::Table *table) {
-  std::cout << __PRETTY_FUNCTION__ << std::endl;
+void benchmark_row_id(grnxx::Table *table, size_t limit) {
+  if (limit != std::numeric_limits<size_t>::max()) {
+    std::cout << "limit = " << limit << ", ";
+  } else {
+    std::cout << "limit = N/A, ";
+  }
 
   double min_elapsed = std::numeric_limits<double>::max();
   std::mt19937_64 rng;
@@ -167,7 +171,9 @@ void benchmark_row_id(grnxx::Table *table) {
     expression_builder->push_row_id();
     orders[0].expression = std::move(expression_builder->release());
     orders[0].type = grnxx::SORTER_REGULAR_ORDER;
-    auto sorter = grnxx::Sorter::create(std::move(orders));
+    grnxx::SorterOptions options;
+    options.limit = limit;
+    auto sorter = grnxx::Sorter::create(std::move(orders), options);
     sorter->sort(&records);
     double elapsed = timer.elapsed();
     if (elapsed < min_elapsed) {
@@ -177,6 +183,15 @@ void benchmark_row_id(grnxx::Table *table) {
   std::cout << "min. elapsed [s] = " << min_elapsed << std::endl;
 }
 
+void benchmark_row_id(grnxx::Table *table) {
+  std::cout << __PRETTY_FUNCTION__ << std::endl;
+
+  benchmark_row_id(table, 10);
+  benchmark_row_id(table, 100);
+  benchmark_row_id(table, 1000);
+  benchmark_row_id(table, std::numeric_limits<size_t>::max());
+}
+
 void benchmark_score(grnxx::Table *table, const char *column_name) {
   double min_elapsed = std::numeric_limits<double>::max();
   for (size_t i = 0; i < LOOP; ++i) {
-------------- next part --------------
HTML����������������������������...
Download 



More information about the Groonga-commit mailing list
Back to archive index