mirror of
https://github.com/NexVeridian/wikidata-to-surrealdb.git
synced 2025-09-02 01:49:13 +00:00
chore: remove bench
This commit is contained in:
parent
a38e8ce9be
commit
10d83cf29e
1 changed files with 0 additions and 50 deletions
|
@ -1,50 +0,0 @@
|
||||||
use anyhow::{Error, Ok, Result};
|
|
||||||
use criterion::{Criterion, criterion_group, criterion_main};
|
|
||||||
use pprof::criterion::{Output, PProfProfiler};
|
|
||||||
use std::{env, time::Duration};
|
|
||||||
use surrealdb::{Surreal, engine::local::Db};
|
|
||||||
use tokio::runtime::Runtime;
|
|
||||||
|
|
||||||
use init_reader::File_Format;
|
|
||||||
use wikidata_to_surrealdb::utils::*;
|
|
||||||
|
|
||||||
async fn inti_db() -> Result<Surreal<Db>, Error> {
|
|
||||||
unsafe { env::set_var("WIKIDATA_LANG", "en") };
|
|
||||||
unsafe { env::set_var("OVERWRITE_DB", "true") };
|
|
||||||
|
|
||||||
let db = init_db::create_db_mem().await?;
|
|
||||||
|
|
||||||
Ok(db)
|
|
||||||
}
|
|
||||||
|
|
||||||
fn bench(c: &mut Criterion) {
|
|
||||||
let mut group = c.benchmark_group("Create DB Entities");
|
|
||||||
|
|
||||||
group.bench_function("Bulk Insert", |b| {
|
|
||||||
b.iter(|| {
|
|
||||||
let rt = Runtime::new().unwrap();
|
|
||||||
rt.block_on(async {
|
|
||||||
let db = inti_db().await.unwrap();
|
|
||||||
let reader = File_Format::new("json")
|
|
||||||
.await
|
|
||||||
.reader("tests/data/bench.json")
|
|
||||||
.await
|
|
||||||
.unwrap();
|
|
||||||
|
|
||||||
CreateVersion::Bulk
|
|
||||||
.run(Some(db.clone()), reader, None, 1000, 100)
|
|
||||||
.await
|
|
||||||
.unwrap();
|
|
||||||
})
|
|
||||||
})
|
|
||||||
});
|
|
||||||
|
|
||||||
group.finish();
|
|
||||||
}
|
|
||||||
|
|
||||||
criterion_group! {
|
|
||||||
name = benches;
|
|
||||||
config = Criterion::default().with_profiler(PProfProfiler::new(120, Output::Protobuf)).measurement_time(Duration::from_secs(50));
|
|
||||||
targets= bench
|
|
||||||
}
|
|
||||||
criterion_main!(benches);
|
|
Loading…
Add table
Add a link
Reference in a new issue