Skip to content

Conversation

@mamcx
Copy link
Contributor

@mamcx mamcx commented Feb 7, 2024

Description of Changes

Adding a test load that mimics patterns common in games we are interested in.

Also documentation on how to use https://github.com/mstange/samply/, which allows to see perf data on Firefox with integrated flamegraph.

Expected complexity level and risk

1

Copy link
Contributor

@kazimuth kazimuth left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Generally looks good, it's nice to have some join benchmarks.

I'm also planning on adding some basic sql benches once #803 is merged, but those won't have joins so this is super helpful.

/// Will generate on `release`:
/// Chunks * 100
/// FootprintTileState * 1'000
/// LocationState * 1'000.000 rows
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could we make this smaller? Million row benchmarks add to the ci run time a lot

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe we should not add this to criterion anyway...

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree with Mario. This benchmark is mainly for performance analysis, so we don't need it to be run in CI. At least not right now.

let start = Instant::now();
black_box(fill_tables(&tables, data)?);

let result = black_box(run(&tables.db, "SELECT * FROM LocationState", AuthCtx::for_testing())?);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Technically this is now timing more than just insertions

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah as long as the inserts succeed we shouldn't need this validation.

assert_eq!(result, EXPECT_ROWS / 100);

#[cfg(not(debug_assertions))]
assert_eq!(result, EXPECT_ROWS / 10);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Slightly confused about the math here, could we define these as constants next to EXPECT_ROWS?


fn make_test_db() -> Result<(RelationalDB, TempDir), DBError> {
let tmp_dir = TempDir::new("stdb_test")?;
let stdb = open_db(&tmp_dir, true, false)?.with_row_count(Arc::new(|_, _| i64::MAX));
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We'll want to use the default row count function so that we produce accurate plans.

}
}

fn game_sql_benchmarks(c: &mut Criterion) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we should just add the utility for right now. We can decide later if we want this to be a CI benchmark.

Comment on lines 44 to 48
#[cfg(not(debug_assertions))]
pub const BASE_ROWS: usize = 1_000;
#[cfg(debug_assertions)]
pub const BASE_ROWS: usize = 10;
const EXPECT_ROWS: usize = BASE_ROWS * 1_000;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lets keep this simple for right now and just have a single table size. Let's do 1M rows each for both tables.

@mamcx mamcx force-pushed the mamcx/subscription-eval-bench branch 3 times, most recently from de5c5d7 to 18b059b Compare February 13, 2024 15:20
@mamcx mamcx marked this pull request as ready for review February 13, 2024 16:51
@mamcx mamcx force-pushed the mamcx/subscription-eval-bench branch from 57a60b5 to 18b059b Compare February 13, 2024 18:04
@joshua-spacetime
Copy link
Collaborator

Closing as this was merged as part of #839

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants