Skip to content
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

Optimize JSON writer #13144

Merged
merged 13 commits into from
Apr 24, 2023
Merged
Show file tree
Hide file tree
Changes from 8 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 13 additions & 7 deletions cpp/benchmarks/io/json/json_writer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -72,13 +72,24 @@ void BM_json_write_io(nvbench::state& state, nvbench::type_list<nvbench::enum_ty

cuio_source_sink_pair source_sink(source_type);
cudf::io::json_writer_options write_opts =
cudf::io::json_writer_options::builder(source_sink.make_sink_info(), view).na_rep("null");
cudf::io::json_writer_options::builder(source_sink.make_sink_info(), view)
.na_rep("null")
.rows_per_chunk(view.num_rows() / 10);

json_write_common(write_opts, source_sink, data_size, state);
}

void BM_json_writer_options(nvbench::state& state)
{
auto const source_type = io_type::HOST_BUFFER;
bool const json_lines = state.get_int64("json_lines");
bool const include_nulls = state.get_int64("include_nulls");
auto const rows_per_chunk = state.get_int64("rows_per_chunk");

if (!(json_lines == false and include_nulls == false) and rows_per_chunk != 1 << 20) {
karthikeyann marked this conversation as resolved.
Show resolved Hide resolved
state.skip("Skipping for unrequired rows_per_chunk combinations");
return;
}
auto const d_type = get_type_or_group({static_cast<int32_t>(data_type::INTEGRAL),
static_cast<int32_t>(data_type::FLOAT),
static_cast<int32_t>(data_type::DECIMAL),
Expand All @@ -88,11 +99,6 @@ void BM_json_writer_options(nvbench::state& state)
static_cast<int32_t>(data_type::LIST),
static_cast<int32_t>(data_type::STRUCT)});

auto const source_type = io_type::HOST_BUFFER;
bool const json_lines = state.get_int64("json_lines");
bool const include_nulls = state.get_int64("include_nulls");
auto const rows_per_chunk = state.get_int64("rows_per_chunk");

auto const tbl = create_random_table(
cycle_dtypes(d_type, num_cols), table_size_bytes{data_size}, data_profile_builder());
auto const view = tbl->view();
Expand Down Expand Up @@ -122,4 +128,4 @@ NVBENCH_BENCH(BM_json_writer_options)
.set_min_samples(4)
.add_int64_axis("json_lines", {false, true})
.add_int64_axis("include_nulls", {false, true})
.add_int64_power_of_two_axis("rows_per_chunk", nvbench::range(10, 20, 2));
.add_int64_power_of_two_axis("rows_per_chunk", {10, 15, 16, 18, 20});
Loading