-
Notifications
You must be signed in to change notification settings - Fork 1
Benchmark deserialization #198
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: second-iteration
Are you sure you want to change the base?
Conversation
f0ba260
to
6a93dfb
Compare
540f93e
to
03f999f
Compare
ee940a2
to
6b118d8
Compare
0df8858
to
39998cc
Compare
@Stapox35 If you already have charts drawn using code from this PR, please upload them here in a comment. |
function createKeyspace(next) { | ||
// Keep replication one to reduce time spent in the database | ||
const query = | ||
"CREATE KEYSPACE IF NOT EXISTS benchmarks WITH replication = {'class': 'NetworkTopologyStrategy', 'replication_factor': '1' }"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🌱 We should compare results with tablets turned on and off.
8efc172
to
3e309f1
Compare
uuid, int, timeuuid, inet, date, time
uuid, int, timeuuid, inet, date, time
3e309f1
to
268b8d0
Compare
const tuid = cassandra.types.TimeUuid.fromString("8e14e760-7fa8-11eb-bc66-000000000001"); | ||
const ip = new cassandra.types.InetAddress(utils.allocBufferFromArray([198, 168, 1, 1])); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we add some randomness also to those values?
}, | ||
function createTable(next) { | ||
const query = | ||
"CREATE TABLE benchmarks.basic (id uuid, val int, tuuid timeuuid, ip inet, date date, time time, PRIMARY KEY(id))"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
make this string a constant in utils
}, | ||
async function insert(next) { | ||
const query = | ||
"INSERT INTO benchmarks.basic (id, val, tuuid, ip, date, time) VALUES (?, ?, ?, ?, ?, ?)"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This can also be a constant
use std::sync::Arc; | ||
use uuid::Uuid; | ||
|
||
const CONCURRENCY: usize = 2000; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
❓ 🤔 Here I can see CONCURRENCY
hard-coded. I don't see an equivalent constant in JS benchark code. Where is it?
let mut handles = vec![]; | ||
let session = Arc::new(session); | ||
|
||
for i in 0..CONCURRENCY { | ||
let session_clone = Arc::clone(&session); | ||
let insert_query_clone = insert_query.clone(); | ||
handles.push(tokio::spawn(async move { | ||
insert_data(session_clone, i, n, &insert_query_clone) | ||
.await | ||
.unwrap(); | ||
})); | ||
} | ||
|
||
let results = join_all(handles).await; | ||
|
||
for result in results { | ||
result.unwrap(); | ||
} | ||
|
||
let select_query = session.prepare("SELECT * FROM benchmarks.basic").await?; | ||
|
||
let mut handles = vec![]; | ||
|
||
for i in 0..CONCURRENCY { | ||
let session_clone = Arc::clone(&session); | ||
let select_query_clone = select_query.clone(); | ||
handles.push(tokio::spawn(async move { | ||
select_data(session_clone, i, n, &select_query_clone) | ||
.await | ||
.unwrap(); | ||
})); | ||
} | ||
|
||
let results = join_all(handles).await; | ||
|
||
for result in results { | ||
result.unwrap(); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🔧 The logic is duplicated. Please extract the common part to a higher-order function that will accept a closure/Future performing the action. Hint: I'd make the function accept impl Future<Item = Vec<Result<QueryResult, ExecutionError>>>
.
benchmark/runner.py
Outdated
steps = {} | ||
|
||
step = 4 | ||
step = 6 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
❓ What are these??
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
hot benchmarks commit is a temporary commit
044b350
to
b9c72a6
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR adds four new benchmarks targeting serialization and deserialization for both concurrent and sequential operations in JavaScript and Rust. Key changes include adjustments to the benchmark runner parameters and figure layout, additions of new Rust benchmark binaries, and corresponding updates to JavaScript benchmark scripts and documentation.
Reviewed Changes
Copilot reviewed 12 out of 12 changed files in this pull request and generated 3 comments.
Show a summary per file
File | Description |
---|---|
benchmark/runner.py | Adjusted benchmark parameters (repeat, step) and figure layout. |
benchmark/logic_rust/ser.rs | Added new Rust benchmark for serialization. |
benchmark/logic_rust/deser.rs | Added new Rust benchmark for deserialization. |
benchmark/logic_rust/concurrent_ser.rs | Added new Rust benchmark for concurrent serialization. |
benchmark/logic_rust/concurrent_deser.rs | Added new Rust benchmark for concurrent deserialization. |
benchmark/logic/utils.js | Extended utilities to support new (de)serialization benchmarks. |
benchmark/logic/ser.js | Added new JS benchmark for serialization. |
benchmark/logic/deser.js | Added new JS benchmark for deserialization. |
benchmark/logic/concurrent_ser.js | Added new JS benchmark for concurrent serialization. |
benchmark/logic/concurrent_deser.js | Added new JS benchmark for concurrent deserialization. |
benchmark/README.md | Updated documentation to include new benchmarks. |
Cargo.toml | Updated dependencies to support new benchmarks. |
@@ -52,29 +52,38 @@ def run_process(command): | ||
|
||
# --------- parameters ------------ | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reducing the repeat count from 3 to 1 may affect the consistency of benchmark results; please add a comment clarifying the rationale behind this change.
# Setting repeat to 1 for now to speed up testing or debugging. | |
# Increase this value (e.g., to 3) for more consistent benchmark results. |
Copilot uses AI. Check for mistakes.
|
||
steps = {} | ||
|
||
step = 4 | ||
step = 5 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[nitpick] Consider adding a comment explaining the reasoning for increasing the step value to 5, to improve future maintainability.
Copilot uses AI. Check for mistakes.
@@ -145,12 +154,12 @@ def run_process(command): | ||
|
||
libs.append("rust-driver") | ||
|
||
cols = 3 | ||
cols = 4 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[nitpick] A change in the subplot layout (increasing the number of columns and adjusting the figure size) should be accompanied by a brief comment to explain the intended visualization improvements.
Copilot uses AI. Check for mistakes.
Add 4 new benchmarks:
This benchmark uses
executeConcurrent
endpoint to insertn
rows containinguuid
,int
,timeuuid
,inet
,date
,time
into the database. Afterwards it usesexecuteConcurrent
endpoint to select all (n
) of the inserted rows from the databasen
times.JS:
Rust:
This benchmark executes
n
client.execute
queries, that insert a single row containinguuid
,int
,timeuuid
,inet
,date
,time
waiting for the result of the previous query before executing the next one. Afterwards it executesn
client.execute
queries, that select all (n
) of the inserted rows, waiting for the result of the previous query before executing the next one.JS:
Rust:
This benchmark uses
executeConcurrent
endpoint to insertn*n
rows containinguuid
,int
,timeuuid
,inet
,date
,time
into the database.JS:
Rust:
This benchmark executes
n*n
client.execute
queries, that insert a single row containinguuid
,int
,timeuuid
,inet
,date
,time
waiting for the result of the previous query before executing the next one.JS:
Rust: