Skip to content

Commit

Permalink
chore: A couple more benches
Browse files Browse the repository at this point in the history
  • Loading branch information
scsmithr committed Nov 30, 2024
1 parent 4f8dde1 commit e76bfa1
Show file tree
Hide file tree
Showing 5 changed files with 48 additions and 2 deletions.
8 changes: 8 additions & 0 deletions bench/standard/aggregates/many_int_groups_1M.bench
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# GROUP BY with many int groups

setup
CREATE TEMP VIEW v(i1, i2) AS
SELECT * FROM generate_series(1, 4) g1, generate_series(1, 1000000) g2

run
SELECT sum(i1) FROM v GROUP BY i2;
9 changes: 9 additions & 0 deletions bench/standard/aggregates/many_med_string_groups_1M.bench
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# GROUP BY with many string groups

setup
CREATE TEMP VIEW v(ints, strings) AS
SELECT a, repeat(b::string, 100)
FROM generate_series(1, 4) g1(a), generate_series(1, 1000000) g2(b)

run
SELECT sum(ints) FROM v GROUP BY strings;
8 changes: 8 additions & 0 deletions bench/standard/aggregates/many_small_string_groups_1M.bench
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# GROUP BY with many string groups

setup
CREATE TEMP VIEW v(ints, strings) AS
SELECT a, b::string FROM generate_series(1, 4) g1(a), generate_series(1, 1000000) g2(b)

run
SELECT sum(ints) FROM v GROUP BY strings;
21 changes: 21 additions & 0 deletions crates/rayexec_bench/src/benchmark.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,27 @@ impl Benchmark {
Self::from_buf_read(reader)
}

/// Construct a benchmark run from some reader.
///
/// The content should include setup queries and benchmark queries.
///
/// Setup queries are annotated with "setup":
///
/// ```text
/// setup
/// CREATE TABLE ...
/// ```
///
/// Benchmark queries are annotated with "run":
///
/// ```text
/// run
/// SELECT * FROM ...
/// ```
///
/// Any number of setup and benchmark queries can be provided, however a
/// setup query cannot be defined after a benchmark query has already been
/// defined.
pub fn from_buf_read(reader: impl BufRead) -> Result<Self> {
let lines = reader.lines();

Expand Down
4 changes: 2 additions & 2 deletions crates/rayexec_bench/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -116,13 +116,13 @@ pub fn run(builder: impl EngineBuilder, default_dir: &str) -> Result<()> {

// Print results.
println!(
"{:<40}\t{:>7}\t{:>14}",
"{:<60}\t{:>6}\t{:>14}",
"benchmark_name", "count", "time_ms"
);

for (name, times) in &all_times {
for (idx, query_time) in times.query_times_ms.iter().enumerate() {
println!("{:<40}\t{:>7}\t{:>14}", name, idx + 1, query_time);
println!("{:<60}\t{:>6}\t{:>14}", name, idx + 1, query_time);
}
}

Expand Down

0 comments on commit e76bfa1

Please sign in to comment.