- Significantly improved time to render full document

- Added support for debugging with tokio-console through tracing feature
- Added extra benchmark for checking time to render first page
- Removed unwraps to just make background loops return and terminate if something goes wrong
- Modularize rendering somewhat
This commit is contained in:
itsjunetime
2024-06-04 15:46:25 -06:00
parent a86730b8da
commit 5825849434
8 changed files with 846 additions and 133 deletions
+6 -3
View File
@@ -41,6 +41,9 @@ impl std::error::Error for BadTermSizeStdin {}
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
#[cfg(feature = "tracing")]
console_subscriber::init();
let file = std::env::args().nth(1).ok_or("Program requires a file to process")?;
let path = PathBuf::from_str(&file)?.canonicalize()?;
@@ -53,9 +56,9 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {
// calling thread::spawn) and that will cause a panic
let mut watcher = notify::recommended_watcher(move |_| {
// This shouldn't fail to send unless the receiver gets disconnected. If that's happened,
// then like the main thread has panicked or something, so it doesn't matter if this panics
// as well
watch_tx.send(renderer::RenderNotif::Reload).unwrap();
// then like the main thread has panicked or something, so it doesn't matter we don't
// handle the error here
_ = watch_tx.send(renderer::RenderNotif::Reload);
})?;
// We're making this nonrecursive 'cause we're just watching a single file, so there's nothing