(refractor) timer and warm up query

This commit is contained in:
polv committed 2026-03-03 12:44:54 +07:00
1 parent 1b2ee0f691
commit d6f2b145c3
13 files changed
+294 -47

No files matched your search

+3 -1
View File
@@ -2,7 +2,7 @@ use rusqlite::{Result, params};
use serde::Serialize;
use crate::{
CJDicError,
CJDicError, Timer,
db::{Database, yomitan_writer::normalize_term},
};
@@ -35,6 +35,8 @@ impl YomitanDatabase {
limit: u32,
offset: u32,
) -> Result<Vec<YomitanRow>, CJDicError> {
let _timer = Timer::new(format!("search_yomitan: {} {}", q_term, q_reading));
let and_or = if q_term == q_reading { "OR" } else { "AND" };
let mut new_t = String::new();
+2 -9
View File
@@ -7,11 +7,10 @@ use std::{
collections::HashMap,
io::{Cursor, Read},
path::{Path, PathBuf},
time::Instant,
};
use zip::ZipArchive;
use crate::CJDicError;
use crate::{CJDicError, Timer};
fn blake3_hex(s: &str) -> String {
format!("{}", hash(s.as_bytes()))
@@ -274,8 +273,8 @@ impl YomitanWriter {
Callback: Fn(YomitanZipImportProgress),
{
let bundle_name = zip_file.file_name();
let _timer = Timer::new(format!("Importing {}", bundle_name));
let start_time = Instant::now();
self.conn.execute_batch("PRAGMA foreign_keys = off")?;
let cursor = Cursor::new(zip_file.bytes()?);
@@ -593,12 +592,6 @@ impl YomitanWriter {
tx.commit()?;
println!(
"Importing {} takes {:.2?}",
zip_file.file_name(),
start_time.elapsed()
);
self.conn.execute_batch(
"
PRAGMA foreign_keys = on;