Skip to content

Commit

Permalink
Make it sync
Browse files Browse the repository at this point in the history
  • Loading branch information
gsserge committed Jan 21, 2025
1 parent 3df0649 commit 71ecde0
Show file tree
Hide file tree
Showing 13 changed files with 779 additions and 1,511 deletions.
296 changes: 0 additions & 296 deletions Cargo.lock

Large diffs are not rendered by default.

7 changes: 1 addition & 6 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -27,22 +27,17 @@ crc32fast = "1.3.2"
chrono = "0.4.31"
parking_lot = "0.12.1"
lru = "0.12.0"
async-channel = "2.3.1"
futures = "0.3.30"
bytes = "1.5.0"
tokio = { version = "1.36", features = ["rt", "sync"] }
quick_cache = "0.6.0"
vart = "0.9.0"
revision = "0.10.0"
[target.'cfg(target_arch = "wasm32")'.dependencies]
getrandom = { version = "0.2.15", features = ["js"] }
wasm-bindgen-futures = "0.4.45"

[dev-dependencies]
tokio = { version = "1", features = ["full"] }
tempdir = "0.3"
rand = "0.8.5"
criterion = { version = "0.5.1", features = ["async_tokio", "html_reports"] }
criterion = { version = "0.5.1", features = ["html_reports"] }
mimalloc = { version = "0.1.39", default-features = false }
num_cpus = "1.16.0"
walkdir = "2.5.0"
Expand Down
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ let value = Bytes::from("world");
txn.set(&key, &value).unwrap();

// Commit the transaction
txn.commit().await.unwrap();
txn.commit().unwrap();
```

## Configuration
Expand Down Expand Up @@ -105,7 +105,7 @@ let store = Store::new(opts).expect("failed to create store");
txn.set(&key2, &value).unwrap();

// Commit changes
txn.commit().await.unwrap();
txn.commit().unwrap();
}

// Read Transaction
Expand All @@ -119,7 +119,7 @@ let store = Store::new(opts).expect("failed to create store");
}

// Close the store when done
store.close().await.unwrap();
store.close().unwrap();
```

### Versioned Operations
Expand Down
29 changes: 14 additions & 15 deletions benches/load_bench.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ fn remove_local_directory(local_dir: &PathBuf) {
}
}

async fn benchmark_load_times_kv_size() {
fn benchmark_load_times_kv_size() {
println!("\n=== Benchmarking Load Times - KV Size Combinations with Key Distribution ===");
println!("Key Size | Value Size | Distribution | Load Time (s) | Store Size (GB)");
println!("------------------------------------------------------------");
Expand Down Expand Up @@ -51,10 +51,10 @@ async fn benchmark_load_times_kv_size() {
for key in &keys {
let mut txn = store.begin().unwrap();
txn.set(key, &default_value).unwrap();
txn.commit().await.unwrap();
txn.commit().unwrap();
}

store.close().await.unwrap();
store.close().unwrap();

// Calculate store size
let store_size = calculate_store_size(&local_dir);
Expand All @@ -72,7 +72,7 @@ async fn benchmark_load_times_kv_size() {
duration.as_secs_f64(),
store_size as f64 / (1024.0 * 1024.0 * 1024.0) // Convert to GB
);
store.close().await.unwrap();
store.close().unwrap();

// Remove the local directory
remove_local_directory(&local_dir);
Expand All @@ -99,10 +99,10 @@ async fn benchmark_load_times_kv_size() {
for key in &keys {
let mut txn = store.begin().unwrap();
txn.set(key, &default_value).unwrap();
txn.commit().await.unwrap();
txn.commit().unwrap();
}

store.close().await.unwrap();
store.close().unwrap();

// Calculate store size
let store_size = calculate_store_size(&local_dir);
Expand All @@ -120,7 +120,7 @@ async fn benchmark_load_times_kv_size() {
duration.as_secs_f64(),
store_size as f64 / (1024.0 * 1024.0 * 1024.0) // Convert to GB
);
store.close().await.unwrap();
store.close().unwrap();

// Remove the local directory
remove_local_directory(&local_dir);
Expand All @@ -129,7 +129,7 @@ async fn benchmark_load_times_kv_size() {
}
}

async fn benchmark_load_times_versions() {
fn benchmark_load_times_versions() {
println!("\n=== Benchmarking Load Times - Version Count ===");
println!("Versions | Keys | Load Time (s) | Store Size (GB)");
println!("------------------------------------------------");
Expand Down Expand Up @@ -162,11 +162,11 @@ async fn benchmark_load_times_versions() {
for _ in 0..version_count {
let mut txn = store.begin().unwrap();
txn.set(key, &default_value).unwrap();
txn.commit().await.unwrap();
txn.commit().unwrap();
}
}

store.close().await.unwrap();
store.close().unwrap();

// Calculate store size
let store_size = calculate_store_size(&local_dir);
Expand All @@ -183,7 +183,7 @@ async fn benchmark_load_times_versions() {
store_size as f64 / (1024.0 * 1024.0 * 1024.0) // Convert to GB
);

store.close().await.unwrap();
store.close().unwrap();

// Remove the local directory
remove_local_directory(&local_dir);
Expand All @@ -203,12 +203,11 @@ fn calculate_store_size(local_dir: &PathBuf) -> u64 {
total_size
}

#[tokio::main]
async fn main() {
fn main() {
println!("Starting Load Time Benchmarks...\n");

benchmark_load_times_kv_size().await;
benchmark_load_times_versions().await;
benchmark_load_times_kv_size();
benchmark_load_times_versions();

println!("\nBenchmarks complete!");
}
Loading

0 comments on commit 71ecde0

Please sign in to comment.