mirror of
https://github.com/patarapolw/cjdic2.git
synced 2026-11-08 17:35:18 +00:00
(refractor) timer and warm up query
This commit is contained in:
1 parent
1b2ee0f691
commit
d6f2b145c3
13 files changed
+294
-47
No files matched your search
@@ -1,11 +1,10 @@
|
||||
use std::{
|
||||
fs::read_dir,
|
||||
path::{Path, absolute},
|
||||
time::Instant,
|
||||
};
|
||||
|
||||
use anyhow::{Context, Ok};
|
||||
use cjdic2_core::AppService;
|
||||
use cjdic2_core::{AppService, Timer};
|
||||
|
||||
mod common;
|
||||
use common::get_db_dir;
|
||||
@@ -24,16 +23,14 @@ fn main() -> Result<(), anyhow::Error> {
|
||||
let p = e.path();
|
||||
|
||||
if p.extension().and_then(|s| s.to_str()) == Some("zip") {
|
||||
let start = Instant::now();
|
||||
let _timer = Timer::new(format!("zip_file: {:?}", p));
|
||||
|
||||
println!("zip_file: {:?}", p);
|
||||
println!(
|
||||
"{:?}",
|
||||
AppService::import_yomitan_zip_file(&mut writer, &p, "ja", |progress| {
|
||||
println!("{:?}", progress);
|
||||
})?,
|
||||
);
|
||||
println!("[{:.2?}]", start.elapsed());
|
||||
} else {
|
||||
println!("not zip_file: {:?}", p);
|
||||
}
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
use std::time::Instant;
|
||||
|
||||
use anyhow::Ok;
|
||||
use cjdic2_core::AppService;
|
||||
use cjdic2_core::{AppService, Timer};
|
||||
|
||||
mod common;
|
||||
use common::get_db_dir;
|
||||
@@ -9,10 +7,11 @@ use common::get_db_dir;
|
||||
fn main() -> Result<(), anyhow::Error> {
|
||||
let service = AppService::new(get_db_dir())?;
|
||||
|
||||
let start = Instant::now();
|
||||
let mut writer = service.get_yomitan_writer()?;
|
||||
AppService::remove_yomitan_dictionary(&mut writer, "JMnedict")?;
|
||||
println!("[{:.2?}]", start.elapsed());
|
||||
{
|
||||
let _timer = Timer::new("remove one".to_string());
|
||||
let mut writer = service.get_yomitan_writer()?;
|
||||
AppService::remove_yomitan_dictionary(&mut writer, "JMnedict")?;
|
||||
}
|
||||
|
||||
Ok(())
|
||||
}
|
||||
@@ -1,7 +1,5 @@
|
||||
use std::time::Instant;
|
||||
|
||||
use anyhow::Ok;
|
||||
use cjdic2_core::AppService;
|
||||
use cjdic2_core::{AppService, Timer};
|
||||
|
||||
mod common;
|
||||
use common::get_db_dir;
|
||||
@@ -9,11 +7,12 @@ use common::get_db_dir;
|
||||
fn main() -> Result<(), anyhow::Error> {
|
||||
let service = AppService::new(get_db_dir())?;
|
||||
|
||||
let start = Instant::now();
|
||||
let rs = service.search_yomitan("擦る", "する", 10, 0)?;
|
||||
println!("{:#?}", rs);
|
||||
println!("n={}", rs.len());
|
||||
println!("[{:.2?}]", start.elapsed());
|
||||
{
|
||||
let _timer = Timer::new("Search".to_string());
|
||||
let rs = service.search_yomitan("擦る", "する", 10, 0)?;
|
||||
println!("{:#?}", rs);
|
||||
println!("n={}", rs.len());
|
||||
}
|
||||
|
||||
Ok(())
|
||||
}
|
||||
@@ -1,9 +1,5 @@
|
||||
|
||||
|
||||
use std::time::Instant;
|
||||
|
||||
use anyhow::Ok;
|
||||
use cjdic2_core::AppService;
|
||||
use cjdic2_core::{AppService, Timer};
|
||||
|
||||
mod common;
|
||||
use common::get_db_dir;
|
||||
@@ -11,9 +7,10 @@ use common::get_db_dir;
|
||||
fn main() -> Result<(), anyhow::Error> {
|
||||
let service = AppService::new(get_db_dir())?;
|
||||
|
||||
let start = Instant::now();
|
||||
service.get_yomitan_writer()?;
|
||||
println!("[{:.2?}]", start.elapsed());
|
||||
{
|
||||
let _timer = Timer::new("update schema".to_string());
|
||||
service.get_yomitan_writer()?;
|
||||
}
|
||||
|
||||
Ok(())
|
||||
}
|
||||
Reference in new issue
Block a user