Skip to content
Merged
Show file tree
Hide file tree
Changes from all 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
8 changes: 4 additions & 4 deletions .github/workflows/rust.yml
Original file line number Diff line number Diff line change
Expand Up @@ -66,10 +66,10 @@ jobs:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
POSTGRES_DB: postgres
# Use 1000 links for main/master branch benchmarks, 10 for pull requests
BENCHMARK_LINKS: ${{ (github.event_name == 'push' && (github.ref == 'refs/heads/main' || github.ref == 'refs/heads/master')) && '1000' || '10' }}
# Use 100000 background links for main/master branch, 100 for pull requests
BENCHMARK_BACKGROUND_LINKS: ${{ (github.event_name == 'push' && (github.ref == 'refs/heads/main' || github.ref == 'refs/heads/master')) && '100000' || '100' }}
# Use 100 links for main/master branch benchmarks, 10 for pull requests
BENCHMARK_LINKS: ${{ (github.event_name == 'push' && (github.ref == 'refs/heads/main' || github.ref == 'refs/heads/master')) && '100' || '10' }}
# Use 1000 background links for main/master branch, 100 for pull requests
BENCHMARK_BACKGROUND_LINKS: ${{ (github.event_name == 'push' && (github.ref == 'refs/heads/main' || github.ref == 'refs/heads/master')) && '1000' || '100' }}
run: |
set -o pipefail
cargo bench --bench bench -- --output-format bencher | tee out.txt
Expand Down
8 changes: 4 additions & 4 deletions rust/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -50,22 +50,22 @@ pub type Result<T, E = Box<dyn error::Error + Sync + Send>> = result::Result<T,

/// Number of background links to create before each benchmark iteration.
/// Configurable via BENCHMARK_BACKGROUND_LINKS environment variable.
/// Default: 3000 (for local testing), CI uses 100 for PRs and 100000 for main branch.
/// Default: 1000 (for local testing), CI uses 100 for PRs and 1000 for main branch.
pub fn background_links() -> usize {
env::var("BENCHMARK_BACKGROUND_LINKS")
.ok()
.and_then(|s| s.parse().ok())
.unwrap_or(3_000)
.unwrap_or(1_000)
}

/// Number of links to create/update/delete in each benchmark operation.
/// Configurable via BENCHMARK_LINKS environment variable.
/// Default: 1000 (for local testing), CI uses 10 for PRs and 1000 for main branch.
/// Default: 100 (for local testing), CI uses 10 for PRs and 100 for main branch.
pub fn benchmark_links() -> usize {
env::var("BENCHMARK_LINKS")
.ok()
.and_then(|s| s.parse().ok())
.unwrap_or(1_000)
.unwrap_or(100)
}
const PARAMS: &str = "user=postgres dbname=postgres password=postgres host=localhost port=5432";

Expand Down