This commit is contained in:
Pere Diaz Bou
2025-09-18 18:40:13 +02:00
parent 0fd704d00f
commit 4f5833c681
2 changed files with 17 additions and 112 deletions

View File

@@ -24,13 +24,7 @@ fn bench_open(criterion: &mut Criterion) {
if !std::fs::exists("../testing/schema_5k.db").unwrap() {
#[allow(clippy::arc_with_non_send_sync)]
let io = Arc::new(PlatformIO::new().unwrap());
let db = Database::open_file(
io.clone(),
"../testing/schema_5k.db",
false,
false,
)
.unwrap();
let db = Database::open_file(io.clone(), "../testing/schema_5k.db", false, false).unwrap();
let conn = db.connect().unwrap();
for i in 0..5000 {
@@ -46,13 +40,8 @@ fn bench_open(criterion: &mut Criterion) {
b.iter(|| {
#[allow(clippy::arc_with_non_send_sync)]
let io = Arc::new(PlatformIO::new().unwrap());
let db = Database::open_file(
io.clone(),
"../testing/schema_5k.db",
false,
false,
)
.unwrap();
let db =
Database::open_file(io.clone(), "../testing/schema_5k.db", false, false).unwrap();
let conn = db.connect().unwrap();
conn.execute("SELECT * FROM table_0").unwrap();
});
@@ -78,13 +67,7 @@ fn bench_alter(criterion: &mut Criterion) {
if !std::fs::exists("../testing/schema_5k.db").unwrap() {
#[allow(clippy::arc_with_non_send_sync)]
let io = Arc::new(PlatformIO::new().unwrap());
let db = Database::open_file(
io.clone(),
"../testing/schema_5k.db",
false,
false,
)
.unwrap();
let db = Database::open_file(io.clone(), "../testing/schema_5k.db", false, false).unwrap();
let conn = db.connect().unwrap();
for i in 0..5000 {
@@ -99,13 +82,7 @@ fn bench_alter(criterion: &mut Criterion) {
group.bench_function(BenchmarkId::new("limbo_rename_table", ""), |b| {
#[allow(clippy::arc_with_non_send_sync)]
let io = Arc::new(PlatformIO::new().unwrap());
let db = Database::open_file(
io.clone(),
"../testing/schema_5k.db",
false,
false,
)
.unwrap();
let db = Database::open_file(io.clone(), "../testing/schema_5k.db", false, false).unwrap();
let conn = db.connect().unwrap();
b.iter_custom(|iters| {
(0..iters)
@@ -150,13 +127,7 @@ fn bench_alter(criterion: &mut Criterion) {
group.bench_function(BenchmarkId::new("limbo_rename_column", ""), |b| {
#[allow(clippy::arc_with_non_send_sync)]
let io = Arc::new(PlatformIO::new().unwrap());
let db = Database::open_file(
io.clone(),
"../testing/schema_5k.db",
false,
false,
)
.unwrap();
let db = Database::open_file(io.clone(), "../testing/schema_5k.db", false, false).unwrap();
let conn = db.connect().unwrap();
b.iter_custom(|iters| {
(0..iters)
@@ -202,13 +173,7 @@ fn bench_alter(criterion: &mut Criterion) {
group.bench_function(BenchmarkId::new("limbo_add_column", ""), |b| {
#[allow(clippy::arc_with_non_send_sync)]
let io = Arc::new(PlatformIO::new().unwrap());
let db = Database::open_file(
io.clone(),
"../testing/schema_5k.db",
false,
false,
)
.unwrap();
let db = Database::open_file(io.clone(), "../testing/schema_5k.db", false, false).unwrap();
let conn = db.connect().unwrap();
b.iter_custom(|iters| {
(0..iters)
@@ -253,13 +218,7 @@ fn bench_alter(criterion: &mut Criterion) {
group.bench_function(BenchmarkId::new("limbo_drop_column", ""), |b| {
#[allow(clippy::arc_with_non_send_sync)]
let io = Arc::new(PlatformIO::new().unwrap());
let db = Database::open_file(
io.clone(),
"../testing/schema_5k.db",
false,
false,
)
.unwrap();
let db = Database::open_file(io.clone(), "../testing/schema_5k.db", false, false).unwrap();
let conn = db.connect().unwrap();
b.iter_custom(|iters| {
(0..iters)
@@ -307,13 +266,7 @@ fn bench_prepare_query(criterion: &mut Criterion) {
#[allow(clippy::arc_with_non_send_sync)]
let io = Arc::new(PlatformIO::new().unwrap());
let db = Database::open_file(
io.clone(),
"../testing/testing.db",
false,
false,
)
.unwrap();
let db = Database::open_file(io.clone(), "../testing/testing.db", false, false).unwrap();
let limbo_conn = db.connect().unwrap();
let queries = [
@@ -392,13 +345,7 @@ fn bench_execute_select_rows(criterion: &mut Criterion) {
#[allow(clippy::arc_with_non_send_sync)]
let io = Arc::new(PlatformIO::new().unwrap());
let db = Database::open_file(
io.clone(),
"../testing/testing.db",
false,
false,
)
.unwrap();
let db = Database::open_file(io.clone(), "../testing/testing.db", false, false).unwrap();
let limbo_conn = db.connect().unwrap();
let mut group = criterion.benchmark_group("Execute `SELECT * FROM users LIMIT ?`");
@@ -466,13 +413,7 @@ fn bench_execute_select_1(criterion: &mut Criterion) {
#[allow(clippy::arc_with_non_send_sync)]
let io = Arc::new(PlatformIO::new().unwrap());
let db = Database::open_file(
io.clone(),
"../testing/testing.db",
false,
false,
)
.unwrap();
let db = Database::open_file(io.clone(), "../testing/testing.db", false, false).unwrap();
let limbo_conn = db.connect().unwrap();
let mut group = criterion.benchmark_group("Execute `SELECT 1`");
@@ -524,13 +465,7 @@ fn bench_execute_select_count(criterion: &mut Criterion) {
#[allow(clippy::arc_with_non_send_sync)]
let io = Arc::new(PlatformIO::new().unwrap());
let db = Database::open_file(
io.clone(),
"../testing/testing.db",
false,
false,
)
.unwrap();
let db = Database::open_file(io.clone(), "../testing/testing.db", false, false).unwrap();
let limbo_conn = db.connect().unwrap();
let mut group = criterion.benchmark_group("Execute `SELECT count() FROM users`");
@@ -588,13 +523,7 @@ fn bench_insert_rows(criterion: &mut Criterion) {
#[allow(clippy::arc_with_non_send_sync)]
let io = Arc::new(PlatformIO::new().unwrap());
let db = Database::open_file(
io.clone(),
db_path.to_str().unwrap(),
false,
false,
)
.unwrap();
let db = Database::open_file(io.clone(), db_path.to_str().unwrap(), false, false).unwrap();
let limbo_conn = db.connect().unwrap();
let mut stmt = limbo_conn
@@ -718,13 +647,7 @@ fn bench_limbo(
let io = Arc::new(PlatformIO::new().unwrap());
let temp_dir = tempfile::tempdir().unwrap();
let path = temp_dir.path().join("bench.db");
let db = Database::open_file(
io.clone(),
path.to_str().unwrap(),
mvcc,
false,
)
.unwrap();
let db = Database::open_file(io.clone(), path.to_str().unwrap(), mvcc, false).unwrap();
let mut connecitons = Vec::new();
{
let conn = db.connect().unwrap();
@@ -807,13 +730,7 @@ fn bench_limbo_mvcc(
let io = Arc::new(PlatformIO::new().unwrap());
let temp_dir = tempfile::tempdir().unwrap();
let path = temp_dir.path().join("bench.db");
let db = Database::open_file(
io.clone(),
path.to_str().unwrap(),
mvcc,
false,
)
.unwrap();
let db = Database::open_file(io.clone(), path.to_str().unwrap(), mvcc, false).unwrap();
let mut connecitons = Vec::new();
let conn0 = db.connect().unwrap();
conn0.execute("CREATE TABLE test (x)").unwrap();

View File

@@ -490,13 +490,7 @@ fn bench_sequential_jsonb(criterion: &mut Criterion) {
#[allow(clippy::arc_with_non_send_sync)]
let io = Arc::new(PlatformIO::new().unwrap());
let db = Database::open_file(
io.clone(),
"../testing/testing.db",
false,
false,
)
.unwrap();
let db = Database::open_file(io.clone(), "../testing/testing.db", false, false).unwrap();
let limbo_conn = db.connect().unwrap();
// Select a subset of JSON payloads to use in the sequential test
@@ -652,13 +646,7 @@ fn bench_json_patch(criterion: &mut Criterion) {
#[allow(clippy::arc_with_non_send_sync)]
let io = Arc::new(PlatformIO::new().unwrap());
let db = Database::open_file(
io.clone(),
"../testing/testing.db",
false,
false,
)
.unwrap();
let db = Database::open_file(io.clone(), "../testing/testing.db", false, false).unwrap();
let limbo_conn = db.connect().unwrap();
let json_patch_cases = [