improve loading process

This commit is contained in:
Simon Gardling 2022-04-22 12:25:42 -04:00
parent 2cf33f9d6b
commit a9b51fab20

View File

@ -122,6 +122,8 @@ impl MathApp {
#[allow(dead_code)] // This is used lol #[allow(dead_code)] // This is used lol
/// Create new instance of [`MathApp`] and return it /// Create new instance of [`MathApp`] and return it
pub fn new(cc: &eframe::CreationContext<'_>) -> Self { pub fn new(cc: &eframe::CreationContext<'_>) -> Self {
let start = instant::Instant::now();
// Remove loading indicator on wasm // Remove loading indicator on wasm
#[cfg(target_arch = "wasm32")] #[cfg(target_arch = "wasm32")]
stop_loading(); stop_loading();
@ -138,8 +140,6 @@ impl MathApp {
tracing::info!("Web Info: {:?}", web_info); tracing::info!("Web Info: {:?}", web_info);
} }
let start = instant::Instant::now();
tracing::info!("Loading assets..."); tracing::info!("Loading assets...");
let mut tar_file_data = Vec::new(); let mut tar_file_data = Vec::new();
let _ = ruzstd::StreamingDecoder::new(&mut include_bytes!("../assets.tar.zst").as_slice()) let _ = ruzstd::StreamingDecoder::new(&mut include_bytes!("../assets.tar.zst").as_slice())
@ -244,13 +244,11 @@ impl MathApp {
]), ]),
}; };
tracing::info!("Done loading assets! Took: {:?}", start.elapsed());
// Initialize fonts // Initialize fonts
// this used to be in the `update` method, but (after a ton of digging) this actually caused OOMs. that was a pain to debug // this used to be in the `update` method, but (after a ton of digging) this actually caused OOMs. that was a pain to debug
cc.egui_ctx.set_fonts(fonts); cc.egui_ctx.set_fonts(fonts);
tracing::info!("egui app initialized."); tracing::info!("Initialized! Took: {:?}", start.elapsed());
Self { Self {
functions: vec![DEFAULT_FUNCTION_ENTRY.clone()], functions: vec![DEFAULT_FUNCTION_ENTRY.clone()],