Example - Add progress to insert printing

This commit is contained in:
asonix 2023-07-04 18:02:22 -05:00
parent 2d5c5e9061
commit 97f5ef8fa8

View file

@ -29,15 +29,18 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
let total_chunks = 32;
let chunk_size = 1024 * 8;
for _ in 0..total_chunks {
for i in 0..total_chunks {
let vectors = (0..chunk_size)
.map(|_| thread_rng().gen::<[f32; 7]>().into())
.collect::<Vec<_>>();
tracing::info!("Inserting vectors");
tracing::info!("Inserting vectors {i}/{total_chunks}");
let now = Instant::now();
db.insert_vectors_blocking(vectors)?;
tracing::info!("Inserting vectors - Took {:?}", now.elapsed());
tracing::info!(
"Inserting vectors {i}/{total_chunks} - Took {:?}",
now.elapsed()
);
}
let existing_vector: Vector<7> = thread_rng().gen::<[f32; 7]>().into();