Skip to content

Commit

Permalink
change benchmark call away from removed cell method, fix benchmark wa…
Browse files Browse the repository at this point in the history
…rnings
  • Loading branch information
tfussell committed Mar 21, 2017
1 parent f6626e5 commit c448536
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 11 deletions.
4 changes: 2 additions & 2 deletions benchmarks/styles.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

std::size_t current_time()
{
return std::chrono::duration<double, std::milli>(std::chrono::system_clock::now().time_since_epoch()).count();
return static_cast<std::size_t>(std::chrono::duration<double, std::milli>(std::chrono::system_clock::now().time_since_epoch()).count());
}

std::size_t random_index(std::size_t max)
Expand Down Expand Up @@ -81,7 +81,7 @@ xlnt::workbook non_optimized_workbook(int n)
for(int idx = 1; idx < n; idx++)
{
auto worksheet = wb[random_index(wb.sheet_count())];
auto cell = worksheet.cell(1, (xlnt::row_t)idx);
auto cell = worksheet.cell(xlnt::cell_reference(1, (xlnt::row_t)idx));
cell.value(0);
cell.style(styles.at(random_index(styles.size())));
}
Expand Down
14 changes: 5 additions & 9 deletions benchmarks/writer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

std::size_t current_time()
{
return std::chrono::duration<double, std::milli>(std::chrono::system_clock::now().time_since_epoch()).count();
return static_cast<std::size_t>(std::chrono::duration<double, std::milli>(std::chrono::system_clock::now().time_since_epoch()).count());
}

// Create a worksheet with variable width rows. Because data must be
Expand All @@ -15,13 +15,6 @@ void writer(int cols, int rows)
xlnt::workbook wb;
auto ws = wb.create_sheet();

std::vector<int> row;

for(int i = 0; i < cols; i++)
{
row.push_back(i);
}

for(int index = 0; index < rows; index++)
{
if ((index + 1) % (rows / 10) == 0)
Expand All @@ -31,7 +24,10 @@ void writer(int cols, int rows)
std::cout.flush();
}

ws.append(row);
for (int i = 0; i < cols; i++)
{
ws.cell(xlnt::cell_reference(i + 1, index + 1)).value(i);
}
}

std::cout << std::endl;
Expand Down

0 comments on commit c448536

Please sign in to comment.