Skip to content

Commit

Permalink
chore(benches): use dedicated ports
Browse files Browse the repository at this point in the history
  • Loading branch information
loyd committed Nov 12, 2023
1 parent c8eddbf commit a505f9b
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,7 @@ See [examples](https://github.com/loyd/clickhouse.rs/tree/master/examples).
## Feature Flags
* `lz4` (enabled by default) — enables `Compression::Lz4` and `Compression::Lz4Hc(_)` variants. If enabled, `Compression::Lz4` is used by default for all queries except for `WATCH`.
* `tls` (enabled by default) — supports urls with the `HTTPS` schema.
* `quanta` (enabled by default) - uses the [`quanta`](https://docs.rs/quanta) crate to speed the inserter up. Not used if `test-util` is enabled (thus, time can be managed by `tokio::time::advance()` in custom tests).
* `quanta` (enabled by default) - uses the [quanta](https://docs.rs/quanta) crate to speed the inserter up. Not used if `test-util` is enabled (thus, time can be managed by `tokio::time::advance()` in custom tests).
* `test-util` — adds mocks. See [the example](https://github.com/loyd/clickhouse.rs/tree/master/examples/mock.rs). Use it only in `dev-dependencies`.
* `watch` — enables `client.watch` functionality. See the corresponding section for details.
* `uuid` — adds `serde::uuid` to work with [uuid](https://docs.rs/uuid) crate.
Expand Down
8 changes: 4 additions & 4 deletions benches/insert.rs
Original file line number Diff line number Diff line change
Expand Up @@ -86,11 +86,11 @@ async fn run_inserter(client: Client, iters: u64) -> Result<Duration> {
Ok(start.elapsed())
}

fn run<F>(c: &mut Criterion, name: &str, f: impl Fn(Client, u64) -> F)
fn run<F>(c: &mut Criterion, name: &str, port: u16, f: impl Fn(Client, u64) -> F)
where
F: Future<Output = Result<Duration>>,
{
let addr = "127.0.0.1:6543".parse().unwrap();
let addr = format!("127.0.0.1:{port}").parse().unwrap();
server::start(addr);

let mut group = c.benchmark_group(name);
Expand Down Expand Up @@ -128,11 +128,11 @@ where
}

fn insert(c: &mut Criterion) {
run(c, "insert", run_insert);
run(c, "insert", 6543, run_insert);
}

fn inserter(c: &mut Criterion) {
run(c, "inserter", run_inserter);
run(c, "inserter", 6544, run_inserter);
}

criterion_group!(benches, insert, inserter);
Expand Down

0 comments on commit a505f9b

Please sign in to comment.